From 9d73aa5566bba00a3b76b07b337af33ea2a359b6 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 9 Sep 2024 19:34:28 +0200 Subject: [PATCH 001/471] Download custom chaincode containers for ARM only when Fabric version is lower than 2.5 Signed-off-by: Jakub Dzikowski --- ...onfig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 4 +++- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 4 +++- ...nfig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 4 +++- ...fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 4 +++- ...nfig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 4 +++- .../templates/fabric-docker/scripts/chaincode-functions-v2.sh | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 91103b2e8..e61f8f44b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2486,7 +2486,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index cb5ac25db..285db2bdc 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2350,7 +2350,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5b4bfb004..ac9973f3a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3276,7 +3276,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 5cb507bf5..283f90b12 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4683,7 +4683,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 2bcb9006a..b1db86d3b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5190,7 +5190,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 168ddc015..d89afe8e8 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -19,7 +19,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use `sort -V` to compare versions, because `sort` handles versions like `2.4` and `2.10` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi From 2466da78c7b2a112450e7043550d4f9a1d126a5e Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 10 Sep 2024 10:49:14 +0200 Subject: [PATCH 002/471] Update upload-artifacts version in CI Signed-off-by: Jakub Dzikowski --- .github/workflows/test-on-push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index d2ca3c8c7..f6eda5a0b 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -23,7 +23,7 @@ jobs: - name: Test simple network run: e2e-network/docker/test-01-simple.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-main @@ -112,7 +112,7 @@ jobs: - name: Test RAFT network run: e2e-network/docker/test-02-raft-2orgs.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-02-raft @@ -137,7 +137,7 @@ jobs: - name: Test private data run: e2e-network/docker/test-03-private-data.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-03-private-data @@ -162,7 +162,7 @@ jobs: - name: Test snapshots run: e2e-network/docker/test-04-snapshot.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-04-snapshot From 624f83ed34123976e24f3d0dc0144afc7916b779 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 10 Sep 2024 12:19:05 +0200 Subject: [PATCH 003/471] Set version 2.0.0 Signed-off-by: Jakub Dzikowski --- README.md | 8 ++++---- docs/sample.json | 2 +- docs/schema.json | 2 +- ...ablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap | 2 +- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 +++--- e2e/__snapshots__/schema.test.ts.snap | 2 +- fablo.sh | 2 +- package-lock.json | 4 ++-- package.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-k8s.json | 2 +- .../fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode.json | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml | 2 +- samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml | 2 +- .../fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json | 2 +- 20 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index d86d2c8ed..99cb8fc55 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ You may keep the script in the root directory of your project or install it glob To install it globally: ```bash -sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo +sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo ``` To get a copy of Fablo for a single project, execute in the project root: ```bash -curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/fablo.sh -o ./fablo && chmod +x ./fablo +curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o ./fablo && chmod +x ./fablo ``` ## Getting started @@ -344,7 +344,7 @@ The basic structure of Fablo config file is as follows: ```json { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { ... }, "orgs": [ ... ], "channels": [ ... ], @@ -507,7 +507,7 @@ Genrated Hooks are saved in `fablo-target/hooks`. ```yaml --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json global: fabricVersion: 2.4.2 tls: false diff --git a/docs/sample.json b/docs/sample.json index 4f31cb0f5..360bec3d8 100644 --- a/docs/sample.json +++ b/docs/sample.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": false, diff --git a/docs/schema.json b/docs/schema.json index a493429c7..fd5981002 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -12,7 +12,7 @@ ], "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json" + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json" }, "global": { "$id": "#/properties/global", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 06005696b..94939945c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -86,7 +86,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper REPOSITORY="https://kfsoftware.github.io/hlf-helm-charts" STORAGE_CLASS=$(kubectl describe sc | grep Name | tr -s ' ' | cut -d ':' -f 2 | cut -d ' ' -f 2) -FABLO_VERSION=1.2.1-unstable.0 +FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_CONFIG= ORDERER_IMAGE=hyperledger/fabric-orderer diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e61f8f44b..99c2362a8 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1524,7 +1524,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 285db2bdc..1271012f1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1434,7 +1434,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index ac9973f3a..3b5fff10f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2095,7 +2095,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 283f90b12..a509860ff 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3018,7 +3018,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index b1db86d3b..64a226525 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3314,7 +3314,7 @@ fi `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index f8acf3d68..10cdeed92 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2909,7 +2909,7 @@ Validation warnings count: 0 exports[`init should init simple fablo config 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -2963,7 +2963,7 @@ exports[`init should init simple fablo config 1`] = ` exports[`init should init simple fablo config with node chaincode 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3025,7 +3025,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` exports[`init should init simple fablo config with node chaincode and rest api 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index a20968227..6923640c9 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -7,7 +7,7 @@ exports[`schema should match snapshot 1`] = ` "default": {}, "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", }, "chaincodes": { "$id": "#/properties/chaincodes", diff --git a/fablo.sh b/fablo.sh index 83e55161a..ffcbc3cc7 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,7 +2,7 @@ set -e -FABLO_VERSION=1.2.1-unstable.0 +FABLO_VERSION=2.0.0 FABLO_IMAGE_NAME="softwaremill/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" diff --git a/package-lock.json b/package-lock.json index 41a98db15..dcfd87437 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generator-fablo", - "version": "1.2.1-unstable.0", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "generator-fablo", - "version": "1.2.1-unstable.0", + "version": "2.0.0", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index 1fd582809..0127a6032 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-fablo", - "version": "1.2.1-unstable.0", + "version": "2.0.0", "description": "Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.", "author": "Piotr Hejwowski , Jakub Dzikowski ", "repository": { diff --git a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json index 047984810..62ef917d6 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.4.7", "tls": false, diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 8c0886b4e..176cb5a0f 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.3.3", "tls": true, diff --git a/samples/fablo-config-hlf2-1org-1chaincode.json b/samples/fablo-config-hlf2-1org-1chaincode.json index 2188ecbd8..4053ad5a0 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml index 65e6ec0e8..c71fef021 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json global: fabricVersion: 2.4.7 tls: false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml index c150b9d6d..2fdb0d9cb 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json global: fabricVersion: 2.4.3 tls: true diff --git a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json index 42b60d1c0..e1686dbfe 100644 --- a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": true, From 5465ae4e605b094e3026ae1e3370063e7cd775a3 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 10 Sep 2024 12:24:42 +0200 Subject: [PATCH 004/471] Update changelog with version 2.0.0 changes Signed-off-by: Jakub Dzikowski --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba0850fa..c054daef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,64 @@ -## 1.2.0-unstable +## 2.0.0 + +### Breaking changes +* Drop support for capabilities v1, and Fabric versions below 2.0.0 + [#461](https://github.com/hyperledger-labs/fablo/pull/461) + [#462](https://github.com/hyperledger-labs/fablo/pull/462) + [#464](https://github.com/hyperledger-labs/fablo/pull/464) + [#473](https://github.com/hyperledger-labs/fablo/pull/473) + [#486](https://github.com/hyperledger-labs/fablo/pull/486) + [#488](https://github.com/hyperledger-labs/fablo/pull/488) +* Drop yarn and nvm installation support + [#455](https://github.com/hyperledger-labs/fablo/pull/455) ### Features +* Add application capability V_2_5 [#463] + [#463](https://github.com/hyperledger-labs/fablo/pull/463) * Support for `chaincode invoke` command (tls and non-tls) + [#403](https://github.com/hyperledger-labs/fablo/pull/403) +* [#413](https://github.com/hyperledger-labs/fablo/pull/413) * Support for `chaincodes list` command (tls and non-tls) + [#409](https://github.com/hyperledger-labs/fablo/pull/409) + [#411](https://github.com/hyperledger-labs/fablo/pull/411) +* Christmas easter egg + [#427](https://github.com/hyperledger-labs/fablo/pull/427) +* Remove dev dependencies on chaincode installation for Node.js + [#450](https://github.com/hyperledger-labs/fablo/pull/450) +* Update Fabric version in the initial configuration + [#470]( https://github.com/hyperledger-labs/fablo/pull/470) +* Publish Fablo Docker image for ARM architecture + [#478](https://github.com/hyperledger-labs/fablo/pull/478) + [#487](https://github.com/hyperledger-labs/fablo/pull/487) ### Fixes -* Remove unsupported test library and dependencies +* Fixed https request when tls is enabled + [#438](https://github.com/hyperledger-labs/fablo/pull/438) +* Fixed issue with `fablo up` command when using CouchDB + [#443](https://github.com/hyperledger-labs/fablo/pull/443) +* Update Docker Compose command + [#465](https://github.com/hyperledger-labs/fablo/pull/465) +* Fixed issue with private data collection + [#460]( https://github.com/hyperledger-labs/fablo/pull/467) * Updated Node.js version from 12 to 16 in chaincode +* Remove unsupported test library and dependencies + +### Chore & Maintenance +* Add contributing guidelines + [#439](https://github.com/hyperledger-labs/fablo/pull/439) +* Documented the Fablo architecture in `ARCHITECTURE.md` file + [#456](https://github.com/hyperledger-labs/fablo/pull/456) +* Changed recommended Node.js version check + [#442](https://github.com/hyperledger-labs/fablo/pull/442) +* Library updates (mostly by Dependabot) +* Various CI improvements and fixes + [#467](https://github.com/hyperledger-labs/fablo/pull/467) + [#458](https://github.com/hyperledger-labs/fablo/pull/458) + [#489](https://github.com/hyperledger-labs/fablo/pull/489) +* Improve .gitignore file + [#476]( https://github.com/hyperledger-labs/fablo/pull/476) ## 1.2.0 + ### Features * Initial Kubernetes support [#351](https://github.com/hyperledger-labs/fablo/issues/351) (not yet so elastic like Fablo in terms of network topology, but ready for first views and comments) From 7fbbb41b260c75e871177fd15b9870c698c85023 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 10 Apr 2024 14:14:54 +0530 Subject: [PATCH 005/471] created a seperate function for node_version check, also covered all the versions for fabric shim Signed-off-by: Sanket added the snapshots Signed-off-by: Sanket suggest recommended node Signed-off-by: Sanket reafactored the code to avoid the breaking due to import of v1.4 added the snapshots fixed the function, now it is returning the proper required version Signed-off-by: Sanket Teli Update src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> changes the directory location Signed-off-by: Sanket Teli added snapshots Signed-off-by: Sanket Teli --- ...1chaincode-raft-explorer.json.test.ts.snap | 56 +++- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 31 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 31 +- ...1chaincode-raft-explorer.json.test.ts.snap | 31 +- package-lock.json | 277 +++++++++++++++++- package.json | 1 + .../scripts/chaincode-functions-v2.sh | 48 ++- 7 files changed, 445 insertions(+), 30 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 99c2362a8..b6f981108 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2470,12 +2470,37 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 @@ -2500,15 +2525,26 @@ chaincodeBuild() { fi fi - if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ \\"$CHAINCODE_LANG\\" = \\"node\\" ]; then + if [ \\"$(command -v nvm)\\" != \\"nvm\\" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ \\"$(command -v nvm)\\" == \\"nvm\\" ]; then + current_dir=\\"$(pwd)\\" + cd \\"$CHAINCODE_DIR_PATH\\" + set +u + nvm install + set -u + cd \\"$current_dir\\" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies.\\"fabric-shim\\"' \\"$CHAINCODE_DIR_PATH/package.json\\") + RECOMMENDED_NODE_VERSION=$(node_version_check \\"$fabric_shim_version\\") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 1271012f1..ed4c95b8e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2334,12 +2334,37 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index a509860ff..0de792cbf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4667,12 +4667,37 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 64a226525..09d70c092 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5174,12 +5174,37 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 diff --git a/package-lock.json b/package-lock.json index dcfd87437..40468d8b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "js-yaml": "^4.1.0", "jsonschema": "^1.2.6", "lodash": "^4.17.21", + "winston": "^2.4.7", "yeoman-generator": "^5.10.0" }, "devDependencies": { @@ -3999,8 +4000,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==", - "devOptional": true, - "peer": true, "engines": { "node": ">=0.1.90" } @@ -4158,6 +4157,41 @@ "node": ">= 8" } }, +<<<<<<< HEAD +======= + "node_modules/cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", + "dev": true + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==", + "engines": { + "node": ">=0.4.0" + } + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -5636,6 +5670,69 @@ "node": ">=4" } }, +<<<<<<< HEAD +======= + "node_modules/extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "dependencies": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -7009,6 +7106,23 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, +<<<<<<< HEAD +======= + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -11576,6 +11690,14 @@ "node": ">= 8" } }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "engines": { + "node": "*" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -13001,6 +13123,30 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "node_modules/winston": { + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.7.tgz", + "integrity": "sha512-vLB4BqzCKDnnZH9PHGoS2ycawueX4HLqENXQitvFHczhgW2vFpSOn31LZtVr1KU8YTw7DS4tM+cqyovxo8taVg==", + "dependencies": { + "async": "^2.6.4", + "colors": "1.0.x", + "cycle": "1.0.x", + "eyes": "0.1.x", + "isstream": "0.1.x", + "stack-trace": "0.0.x" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/winston/node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -17453,9 +17599,7 @@ "colors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==", - "devOptional": true, - "peer": true + "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==" }, "combined-stream": { "version": "1.0.8", @@ -17580,6 +17724,37 @@ "which": "^2.0.1" } }, +<<<<<<< HEAD +======= + "cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", + "dev": true + }, + "cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "requires": { + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + } + } + }, + "cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -18697,6 +18872,56 @@ "tmp": "^0.0.33" } }, +<<<<<<< HEAD +======= + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + } + } + }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -19716,6 +19941,20 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, +<<<<<<< HEAD +======= + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -23169,6 +23408,11 @@ "minipass": "^3.1.1" } }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==" + }, "stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -24245,6 +24489,29 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "winston": { + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.7.tgz", + "integrity": "sha512-vLB4BqzCKDnnZH9PHGoS2ycawueX4HLqENXQitvFHczhgW2vFpSOn31LZtVr1KU8YTw7DS4tM+cqyovxo8taVg==", + "requires": { + "async": "^2.6.4", + "colors": "1.0.x", + "cycle": "1.0.x", + "eyes": "0.1.x", + "isstream": "0.1.x", + "stack-trace": "0.0.x" + }, + "dependencies": { + "async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "requires": { + "lodash": "^4.17.14" + } + } + } + }, "word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", diff --git a/package.json b/package.json index 0127a6032..b3f81f51d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "js-yaml": "^4.1.0", "jsonschema": "^1.2.6", "lodash": "^4.17.21", + "winston": "^2.4.7", "yeoman-generator": "^5.10.0" }, "devDependencies": { diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index d89afe8e8..e2cf6d791 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -9,6 +9,31 @@ dockerPullIfMissing() { fi } +node_version_check(){ + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 @@ -34,14 +59,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: `source ~/.nvm/nvm.sh || true` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" From a7fbff4ca3955df08752f67af7b30d2e1e4d176a Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 10 Sep 2024 16:33:20 +0530 Subject: [PATCH 006/471] updated snapshots Signed-off-by: Sanket Teli --- ...1chaincode-raft-explorer.json.test.ts.snap | 32 ++-- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 39 ++-- ...2chaincodes-private-data.yaml.test.ts.snap | 48 ++++- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 39 ++-- ...1chaincode-raft-explorer.json.test.ts.snap | 39 ++-- package-lock.json | 174 ------------------ 6 files changed, 133 insertions(+), 238 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b6f981108..62b6b7fe5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2470,27 +2470,27 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -2525,25 +2525,25 @@ chaincodeBuild() { fi fi - if [ \\"$CHAINCODE_LANG\\" = \\"node\\" ]; then - if [ \\"$(command -v nvm)\\" != \\"nvm\\" ] && [ -f ~/.nvm/nvm.sh ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) set +e source ~/.nvm/nvm.sh set -e - if [ \\"$(command -v nvm)\\" == \\"nvm\\" ]; then - current_dir=\\"$(pwd)\\" - cd \\"$CHAINCODE_DIR_PATH\\" + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" set +u nvm install set -u - cd \\"$current_dir\\" + cd "$current_dir" fi fi NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies.\\"fabric-shim\\"' \\"$CHAINCODE_DIR_PATH/package.json\\") - RECOMMENDED_NODE_VERSION=$(node_version_check \\"$fabric_shim_version\\") + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ed4c95b8e..0677a9c33 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2334,27 +2334,27 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -2390,14 +2390,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 3b5fff10f..412d243c5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3266,6 +3266,31 @@ dockerPullIfMissing() { fi } +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 @@ -3291,14 +3316,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 0de792cbf..19503c67c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4667,27 +4667,27 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -4723,14 +4723,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 09d70c092..a7c7b27cf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5174,27 +5174,27 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -5230,14 +5230,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/package-lock.json b/package-lock.json index 40468d8b3..8ec5e9e25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4157,32 +4157,6 @@ "node": ">= 8" } }, -<<<<<<< HEAD -======= - "node_modules/cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "dependencies": { - "cssom": "~0.3.6" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - }, "node_modules/cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", @@ -4191,7 +4165,6 @@ "node": ">=0.4.0" } }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -5670,60 +5643,6 @@ "node": ">=4" } }, -<<<<<<< HEAD -======= - "node_modules/extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "dependencies": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", @@ -5732,7 +5651,6 @@ "node": "> 0.1.90" } }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -7106,23 +7024,11 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, -<<<<<<< HEAD -======= - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -17724,37 +17630,11 @@ "which": "^2.0.1" } }, -<<<<<<< HEAD -======= - "cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - } - } - }, "cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -18872,56 +18752,11 @@ "tmp": "^0.0.33" } }, -<<<<<<< HEAD -======= - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - } - } - }, "eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -19941,20 +19776,11 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, -<<<<<<< HEAD -======= - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", From c22785b5ffb402e6396bf15618208dd6d646def2 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 10 Sep 2024 17:06:42 +0530 Subject: [PATCH 007/471] updated Signed-off-by: Sanket Teli --- ...org-1chaincode-raft-explorer.json.test.ts.snap | 15 --------------- ...-config-hlf2-1org-1chaincode.json.test.ts.snap | 15 --------------- ...rgs-2chaincodes-private-data.yaml.test.ts.snap | 15 --------------- ...-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 15 --------------- ...rgs-1chaincode-raft-explorer.json.test.ts.snap | 15 --------------- .../scripts/chaincode-functions-v2.sh | 15 --------------- 6 files changed, 90 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 62b6b7fe5..8ba0285b2 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2526,21 +2526,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 0677a9c33..c9d881ec6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2390,21 +2390,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 412d243c5..fc5b44dd3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3316,21 +3316,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 19503c67c..26ad2be93 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4723,21 +4723,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index a7c7b27cf..a79e2338d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5230,21 +5230,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index e2cf6d791..f35d4c26d 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -59,21 +59,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: `source ~/.nvm/nvm.sh || true` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") From 7948811e4a76dd6a48a222ebe7f9f10cafd17165 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:29:43 +0200 Subject: [PATCH 008/471] Update changelog: add info about new Fablo Docker image registry Signed-off-by: Jakub Dzikowski --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c054daef1..5efde50d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,8 @@ [#489](https://github.com/hyperledger-labs/fablo/pull/489) * Improve .gitignore file [#476]( https://github.com/hyperledger-labs/fablo/pull/476) +* Update Fablo docker image registry to GHCR + [#491](https://github.com/hyperledger-labs/fablo/pull/491) ## 1.2.0 From 725423ce419ce2630bb23b191a4c07357c4da0cc Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:27:13 +0200 Subject: [PATCH 009/471] Update Fablo Docker image registry to GHCR Signed-off-by: Jakub Dzikowski --- .github/workflows/publish-docker-on-main.yml | 12 ++-- .github/workflows/release-on-tag.yml | 2 +- CHANGELOG.md | 2 +- README.md | 10 +-- fablo-build.sh | 6 +- fablo.sh | 4 +- samples/invalid-fablo-config.json | 67 ++++++++++++++++++++ src/repositoryUtils.ts | 2 +- 8 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 samples/invalid-fablo-config.json diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index 9854955e6..79c91d8c7 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -5,9 +5,6 @@ on: branches: - main -env: - IMAGE_NAME: softwaremill/fablo - jobs: publish-docker: runs-on: ubuntu-latest @@ -21,11 +18,12 @@ jobs: with: driver: docker-container - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Login to GHCR + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_LOGIN }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image run: | diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index bdcc5e71f..8570a4e36 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -41,7 +41,7 @@ jobs: - name: Publish Docker image run: | FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push softwaremill/fablo:"$FABLO_VERSION" + docker push ghcr.io/hyperledger-labs/fablo:"$FABLO_VERSION" - name: Create GitHub Release uses: "marvinpinto/action-automatic-releases@latest" diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efde50d2..81b56ebbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,7 +117,7 @@ ## 0.3.0 ### Features -* Add [Fablo REST](https://github.com/softwaremill/fablo-rest/) support +* Add [Fablo REST](https://github.com/fablo-io/fablo-rest/) support * By default all peers are anchor peers * Support `postGenerate` hook * Added support for [Orderer sharding](https://github.com/hyperledger-labs/fablo/issues/220) (multiple orderer groups). diff --git a/README.md b/README.md index 99cb8fc55..95ebe9799 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Fablo supports: * RAFT and solo consensus protocols * Multiple organizations and channels * Chaincode installation and upgrade -* REST API client for CA and chaincodes ([Fablo REST](https://github.com/softwaremill/fablo-rest)) +* REST API client for CA and chaincodes ([Fablo REST](https://github.com/fablo-io/fablo-rest)) * [Blockchain Explorer](https://github.com/hyperledger/blockchain-explorer) which can be enabled for each organization ## See it in action @@ -42,7 +42,7 @@ To create a local Hyperledger Fabric network with Node.js chaincode and REST API ``` After a few minutes the whole network will be set up and running. -You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/softwaremill/fablo-rest)). +You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/fablo-io/fablo-rest)). ## Basic usage @@ -78,7 +78,7 @@ Good step to start your adventure with Fablo or set up a fast prototype. Fablo `init` command takes three parameters (the order does not matter): * Option `node` makes Fablo to generate a sample Node.js chaincode as well. -* Option `rest` enables simple REST API with [Fablo REST](https://github.com/softwaremill/fablo-rest) as standalone Docker container. +* Option `rest` enables simple REST API with [Fablo REST](https://github.com/fablo-io/fablo-rest) as standalone Docker container. * Option `dev` enables running peers in dev mode (so the hot reload for chaincode is possible). Sample command: @@ -570,9 +570,9 @@ You can find them in `fablo-target/fablo-config/connection-profiles` directory i ### REST API -Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/softwaremill/fablo-rest). +Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/fablo-io/fablo-rest). If you want to use it, provide for your organization `"tools": { "fabloRest": true }`. -Visit the [Fablo REST](https://github.com/softwaremill/fablo-rest) project for more documentation. +Visit the [Fablo REST](https://github.com/fablo-io/fablo-rest) project for more documentation. ### Blockchain Explorer diff --git a/fablo-build.sh b/fablo-build.sh index 4ff749044..a261521a4 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -15,7 +15,7 @@ echo " FABLO_HOME: $FABLO_HOME" echo " FABLO_VERSION: $FABLO_VERSION" echo " VERSION_DETAILS: $VERSION_DETAILS" -IMAGE_BASE_NAME="softwaremill/fablo:$FABLO_VERSION" +IMAGE_BASE_NAME="ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then set +e @@ -37,7 +37,7 @@ if [ "${1:-''}" = "--push" ]; then docker buildx build \ --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --platform linux/amd64,linux/arm64 \ - --tag "softwaremill/fablo:$FABLO_VERSION" \ + --tag "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" \ --push \ "$FABLO_HOME" else @@ -45,5 +45,5 @@ else --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" - docker tag "$IMAGE_BASE_NAME" "softwaremill/fablo:$FABLO_VERSION" + docker tag "$IMAGE_BASE_NAME" "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" fi diff --git a/fablo.sh b/fablo.sh index ffcbc3cc7..cc3a43885 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,8 +2,8 @@ set -e -FABLO_VERSION=2.0.0 -FABLO_IMAGE_NAME="softwaremill/fablo" +FABLO_VERSION=1.2.1-unstable.0 +FABLO_IMAGE_NAME="ghcr.io/hyperledger-labs/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" COMMAND="$1" diff --git a/samples/invalid-fablo-config.json b/samples/invalid-fablo-config.json new file mode 100644 index 000000000..eefc9daef --- /dev/null +++ b/samples/invalid-fablo-config.json @@ -0,0 +1,67 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", + "global": { + "fabricVersion": "2.5.12", + "tls": true, + "tools": { + "explorer": true + } + }, + "orgs": [ + { + "organization": { + "name": "some-org1", + "domain": "orderer.example.com", + "mspName": "some-org1" + }, + "orderers": [ + { + "groupName": "group1", + "type": "raft", + "instances": 1 + } + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "ca": { + "db": "postgres" + }, + "peer": { + "instances": 1, + "db": "CouchDb" + }, + "tools": { + "fabloRest": true + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ], + "hooks": { + "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' \"./fablo-target/fabric-config/configtx.yaml\"" + } +} \ No newline at end of file diff --git a/src/repositoryUtils.ts b/src/repositoryUtils.ts index 03919cd83..58d61e943 100644 --- a/src/repositoryUtils.ts +++ b/src/repositoryUtils.ts @@ -1,6 +1,6 @@ import got from "got"; -const repositoryName = "softwaremill/fablo"; +const repositoryName = "ghcr.io/hyperledger-labs/fablo"; const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`; const incrementVersionFragment = (versionFragment: string) => { From b9fc247b5b5282de7b028df5b0a4a1bab9c8d0dd Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:42:48 +0200 Subject: [PATCH 010/471] Update Fablo REST version and registry Signed-off-by: Jakub Dzikowski --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- src/setup-docker/index.ts | 2 +- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- src/setup-k8s/index.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 8ba0285b2..85c4f24e4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2034,7 +2034,7 @@ services: fablo-rest.org1.example.com: container_name: fablo-rest.org1.example.com - image: softwaremill/fablo-rest:\${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=Org1MSP diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 26ad2be93..3e3f8a648 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4091,7 +4091,7 @@ services: fablo-rest.org1.example.com: container_name: fablo-rest.org1.example.com - image: softwaremill/fablo-rest:\${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=Org1MSP diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 47ac08e08..092dfe784 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -161,7 +161,7 @@ export default class SetupDockerGenerator extends Generator { paths: global.paths, fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), - fabloRestVersion: "0.1.0", + fabloRestVersion: "0.1.2", hyperledgerExplorerVersion: "1.1.8", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9ac57cbb3..2ec40b3d3 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -110,7 +110,7 @@ services: <%_ if (org.tools.fabloRest) { _%> <%= org.tools.fabloRest.address %>: container_name: <%= org.tools.fabloRest.address %> - image: softwaremill/fablo-rest:${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=<%= org.tools.fabloRest.mspId %> diff --git a/src/setup-k8s/index.ts b/src/setup-k8s/index.ts index 473da5943..36a99e889 100644 --- a/src/setup-k8s/index.ts +++ b/src/setup-k8s/index.ts @@ -68,7 +68,7 @@ export default class SetupDockerGenerator extends Generator { paths: global.paths, fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), - fabloRestVersion: "0.1.0", + fabloRestVersion: "0.1.2", hyperledgerExplorerVersion: "1.1.8", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", From 561592dcd828e61e0eb917f28a6a4e3b5ac53839 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 14:17:36 +0200 Subject: [PATCH 011/471] Update getting Fablo versions Signed-off-by: Jakub Dzikowski --- src/repositoryUtils.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/repositoryUtils.ts b/src/repositoryUtils.ts index 58d61e943..d3c30be0a 100644 --- a/src/repositoryUtils.ts +++ b/src/repositoryUtils.ts @@ -1,7 +1,6 @@ import got from "got"; -const repositoryName = "ghcr.io/hyperledger-labs/fablo"; -const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`; +const repositoryTagsListUrl = `https://api.github.com/repos/hyperledger-labs/fablo/releases`; const incrementVersionFragment = (versionFragment: string) => { if (versionFragment.includes("-")) { @@ -55,21 +54,23 @@ const version = (v: string): Version => ({ }, }); -const requestVersionNames = (): Promise<{ results: { name: string }[] }> => { +const requestVersionNames = (): Promise<{ tag_name: string }[]> => { const params = { searchParams: { tag_status: "active", page_size: 1024, }, }; - return got(repositoryTagsListUrl, params).json<{ results: { name: string }[] }>(); + return got(repositoryTagsListUrl, params).json<{ tag_name: string }[]>(); }; +const versionRegex = /^v\d+\.\d+\.\d+(-[a-zA-Z0-9-]+)?$/; + const getAvailableTags = async (): Promise => { try { - const versionNames = (await requestVersionNames()).results - .filter((v) => v.name !== "latest") - .map((tag) => tag.name); + const versionNames = (await requestVersionNames()) + .filter((release) => versionRegex.test(release.tag_name)) + .map((release) => release.tag_name.slice(1)); return sortVersions(versionNames); } catch (err) { console.log(`Could not check for updates. Url: '${repositoryTagsListUrl}' not available`); From 6a76efedae8a7a33c5f4d05305464fcb16b5a9fa Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 14:17:49 +0200 Subject: [PATCH 012/471] Update snapshots Signed-off-by: Jakub Dzikowski --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 85c4f24e4..e86497d72 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1526,7 +1526,7 @@ fi exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index c9d881ec6..b207f8f5d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1436,7 +1436,7 @@ fi exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index fc5b44dd3..33bc82dc4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2097,7 +2097,7 @@ fi exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 3e3f8a648..1f2d6803a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3020,7 +3020,7 @@ fi exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index a79e2338d..f6e7b7d26 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3316,7 +3316,7 @@ fi exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 From c7dadc145bdc65907a6475ff9c195310189757f2 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 16:41:58 +0200 Subject: [PATCH 013/471] Set Docker registry to ghcr.io/fablo-io/fablo Signed-off-by: Jakub Dzikowski --- .github/workflows/release-on-tag.yml | 2 +- fablo-build.sh | 6 +++--- fablo.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 8570a4e36..6ada1b7d3 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -41,7 +41,7 @@ jobs: - name: Publish Docker image run: | FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push ghcr.io/hyperledger-labs/fablo:"$FABLO_VERSION" + docker push ghcr.io/fablo-io/fablo:"$FABLO_VERSION" - name: Create GitHub Release uses: "marvinpinto/action-automatic-releases@latest" diff --git a/fablo-build.sh b/fablo-build.sh index a261521a4..be08ec90d 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -15,7 +15,7 @@ echo " FABLO_HOME: $FABLO_HOME" echo " FABLO_VERSION: $FABLO_VERSION" echo " VERSION_DETAILS: $VERSION_DETAILS" -IMAGE_BASE_NAME="ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" +IMAGE_BASE_NAME="ghcr.io/fablo-io/fablo:$FABLO_VERSION" if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then set +e @@ -37,7 +37,7 @@ if [ "${1:-''}" = "--push" ]; then docker buildx build \ --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --platform linux/amd64,linux/arm64 \ - --tag "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" \ + --tag "ghcr.io/fablo-io/fablo:$FABLO_VERSION" \ --push \ "$FABLO_HOME" else @@ -45,5 +45,5 @@ else --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" - docker tag "$IMAGE_BASE_NAME" "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" + docker tag "$IMAGE_BASE_NAME" "ghcr.io/fablo-io/fablo:$FABLO_VERSION" fi diff --git a/fablo.sh b/fablo.sh index cc3a43885..ac6dbaeaa 100755 --- a/fablo.sh +++ b/fablo.sh @@ -3,7 +3,7 @@ set -e FABLO_VERSION=1.2.1-unstable.0 -FABLO_IMAGE_NAME="ghcr.io/hyperledger-labs/fablo" +FABLO_IMAGE_NAME="ghcr.io/fablo-io/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" COMMAND="$1" From ba8e4ed06f0d9d74201561bab6e751eb6a34bf3d Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 16:50:35 +0200 Subject: [PATCH 014/471] Update release action Signed-off-by: Jakub Dzikowski --- .github/workflows/release-on-tag.yml | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 6ada1b7d3..4055a0697 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -25,29 +25,28 @@ jobs: exit 1 fi - - name: Build Fablo - run: | - shellcheck --version - yamllint -v - npm install - ./fablo-build.sh + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Login to GHCR + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_LOGIN }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Publish Docker image + - name: Build and push Docker image run: | - FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push ghcr.io/fablo-io/fablo:"$FABLO_VERSION" + shellcheck --version + yamllint -v + npm install + ./fablo-build.sh --push - - name: Create GitHub Release - uses: "marvinpinto/action-automatic-releases@latest" + - name: Create release + uses: softprops/action-gh-release@v2 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false files: | docs/schema.json fablo.sh From 1685fa6395c3e3e5c0692cc4636d2b6176f38ca2 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 17:14:32 +0200 Subject: [PATCH 015/471] Update GHCR credentials Signed-off-by: Jakub Dzikowski --- .github/workflows/publish-docker-on-main.yml | 4 ++-- .github/workflows/release-on-tag.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index 79c91d8c7..bc1438f73 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -22,8 +22,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.GHCR_USER }} + password: ${{ secrets.GHCR_TOKEN }} - name: Build and push Docker image run: | diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 4055a0697..92995e5db 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -34,8 +34,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.GHCR_USER }} + password: ${{ secrets.GHCR_TOKEN }} - name: Build and push Docker image run: | From 3fa06a59011878be9be49452fc34d7aa4e5f64f3 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 19:35:49 +0200 Subject: [PATCH 016/471] Fix errors when yeoman is printing messages Signed-off-by: Jakub Dzikowski --- e2e/fabloCommands.test.ts | 32 ++++++++++++++++++++++++++++ src/app/index.ts | 6 +++--- src/extend-config/index.ts | 2 +- src/init/index.ts | 10 ++++----- src/list-compatible-updates/index.ts | 14 ++++++------ src/list-versions/index.ts | 2 +- src/setup-docker/index.ts | 12 +++++------ src/setup-k8s/index.ts | 10 ++++----- src/validate/index.ts | 20 ++++++++--------- src/version/index.ts | 4 ++-- 10 files changed, 72 insertions(+), 40 deletions(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index b010927c8..0467df2e6 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -1,5 +1,7 @@ import TestCommands from "./TestCommands"; import { version as currentFabloVersion } from "../package.json"; +import { FabloConfigJson } from "../generators/types/FabloConfigJson"; +import * as fs from "fs"; const commands = new TestCommands("e2e/__tmp__/commands-tests"); @@ -104,6 +106,36 @@ describe("validate", () => { expect(commandResult.output).toContain("commands-tests/fablo-config.json does not exist\n"); expect(commands.getFiles()).toEqual([]); }); + + it("should print validation errors", () => { + // Given + const sourceConfigPath = require.resolve("../samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json"); + const samplesDir = sourceConfigPath.replace("/fablo-config-hlf2-1org-1chaincode-raft-explorer.json", ""); + const sourceConfig = require(sourceConfigPath) as FabloConfigJson; + + // old schema + sourceConfig.$schema = "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json" + + // invalid org + sourceConfig.orgs[0].organization.mspName = "some-org1"; + sourceConfig.orgs[0].organization.name = "some-org1"; + + // save updated config + fs.writeFileSync(`${samplesDir}/invalid-fablo-config.json`, JSON.stringify(sourceConfig, null, 2)); + const fabloConfig = `${commands.relativeRoot}/samples/invalid-fablo-config.json`; + + // When + const commandResult = commands.fabloExec(`validate ${fabloConfig}`); + + // Then + expect(commandResult).toEqual(TestCommands.success()); + expect(commandResult.output).toContain("Critical error occured"); + expect(commandResult.output).toContain("Json schema validation failed!"); + expect(commandResult.output).toContain("instance.$schema : does not exactly match expected constant"); + expect(commandResult.output).toContain(" instance.orgs[0].organization.name : does not match pattern"); + expect(commandResult.output).toContain(" instance.orgs[0].organization.mspName : does not match pattern"); + expect(commands.getFiles()).toEqual([]); + }); }); describe("extend config", () => { diff --git a/src/app/index.ts b/src/app/index.ts index 7548441d3..e94ef2b05 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -3,8 +3,8 @@ import * as Generator from "yeoman-generator"; export default class extends Generator { displayInfo(): void { const url = "https://github.com/hyperledger-labs/fablo"; - this.log("This is main entry point for Yeoman app used in Fablo."); - this.log("Visit the project page to get more information."); - this.log(`---\n${url}\n---`); + console.log("This is main entry point for Yeoman app used in Fablo."); + console.log("Visit the project page to get more information."); + console.log(`---\n${url}\n---`); } } diff --git a/src/extend-config/index.ts b/src/extend-config/index.ts index ee0998947..6c9b92758 100644 --- a/src/extend-config/index.ts +++ b/src/extend-config/index.ts @@ -22,7 +22,7 @@ class ExtendConfigGenerator extends Generator { const fabloConfigPath = `${this.env.cwd}/${this.options.fabloConfig}`; const json = parseFabloConfig(this.fs.read(fabloConfigPath)); const configExtended = extendConfig(json); - this.log(JSON.stringify(configExtended, undefined, 2)); + console.log(JSON.stringify(configExtended, undefined, 2)); } } diff --git a/src/init/index.ts b/src/init/index.ts index cb550fe6b..000730544 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -13,7 +13,7 @@ export default class InitGenerator extends Generator { const shouldInitWithNodeChaincode = this.args.length && this.args.find((v) => v === "node"); if (shouldInitWithNodeChaincode) { - this.log("Creating sample Node.js chaincode"); + console.log("Creating sample Node.js chaincode"); this.fs.copy(this.templatePath("chaincodes"), this.destinationPath("chaincodes")); // force build on Node 12, since dev deps (@theledger/fabric-mock-stub) may not work on 16 this.fs.write(this.destinationPath("chaincodes/chaincode-kv-node/.nvmrc"), "12"); @@ -42,10 +42,10 @@ export default class InitGenerator extends Generator { this.fs.write(this.destinationPath("fablo-config.json"), JSON.stringify(fabloConfigJson, undefined, 2)); this.on("end", () => { - this.log("==========================================================="); - this.log(chalk.bold("Sample config file created! :)")); - this.log("You can start your network with 'fablo up' command"); - this.log("==========================================================="); + console.log("==========================================================="); + console.log(chalk.bold("Sample config file created! :)")); + console.log("You can start your network with 'fablo up' command"); + console.log("==========================================================="); }); } } diff --git a/src/list-compatible-updates/index.ts b/src/list-compatible-updates/index.ts index 2c97cfd5d..092660288 100644 --- a/src/list-compatible-updates/index.ts +++ b/src/list-compatible-updates/index.ts @@ -14,13 +14,13 @@ export default class ListCompatibleUpdatesGenerator extends Generator { _printVersions(versionsToPrint: string[]): void { if (versionsToPrint.length > 0) { - this.log(chalk.bold("====== !Compatible Fablo versions found! :) =============")); - this.log(`${chalk.underline.bold("Compatible")} versions:`); - versionsToPrint.forEach((version) => this.log(`- ${version}`)); - this.log(""); - this.log("To update just run command:"); - this.log(`\t${chalk.bold("fablo use [version]")}`); - this.log(chalk.bold("===========================================================")); + console.log(chalk.bold("====== !Compatible Fablo versions found! :) =============")); + console.log(`${chalk.underline.bold("Compatible")} versions:`); + versionsToPrint.forEach((version) => console.log(`- ${version}`)); + console.log(""); + console.log("To update just run command:"); + console.log(`\t${chalk.bold("fablo use [version]")}`); + console.log(chalk.bold("===========================================================")); } } } diff --git a/src/list-versions/index.ts b/src/list-versions/index.ts index 143d399cd..a16e7c214 100644 --- a/src/list-versions/index.ts +++ b/src/list-versions/index.ts @@ -9,6 +9,6 @@ export default class ListVersionsGenerator extends Generator { .map((v) => (v === config.fabloVersion ? `${v} <== current` : v)) .map((v) => (config.isFabloVersionSupported(v) && !v.includes("current") ? `${v} (compatible)` : v)); - versionsSortedAndMarked.forEach((version) => this.log(`- ${version}`)); + versionsSortedAndMarked.forEach((version) => console.log(`- ${version}`)); } } diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 092dfe784..560eb1e8a 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -48,9 +48,9 @@ export default class SetupDockerGenerator extends Generator { .replace(/[^0-9]+/g, ""); const composeNetworkName = `fablo_network_${dateString}`; - this.log(`Used network config: ${fabloConfigPath}`); - this.log(`Fabric version is: ${global.fabricVersion}`); - this.log(`Generating docker-compose network '${composeNetworkName}'...`); + console.log(`Used network config: ${fabloConfigPath}`); + console.log(`Fabric version is: ${global.fabricVersion}`); + console.log(`Generating docker-compose network '${composeNetworkName}'...`); // ======= fabric-config ============================================================ this._copyOrgCryptoConfig(orgs); @@ -73,9 +73,9 @@ export default class SetupDockerGenerator extends Generator { this._copyHooks(config.hooks); this.on("end", () => { - this.log("Done & done !!! Try the network out: "); - this.log("-> fablo up - to start network"); - this.log("-> fablo help - to view all commands"); + console.log("Done & done !!! Try the network out: "); + console.log("-> fablo up - to start network"); + console.log("-> fablo help - to view all commands"); }); } diff --git a/src/setup-k8s/index.ts b/src/setup-k8s/index.ts index 36a99e889..4c5a9cc87 100644 --- a/src/setup-k8s/index.ts +++ b/src/setup-k8s/index.ts @@ -32,8 +32,8 @@ export default class SetupDockerGenerator extends Generator { .replace(/[^0-9]+/g, ""); const composeNetworkName = `fablo_network_${dateString}`; - this.log(`Used network config: ${fabloConfigPath}`); - this.log(`Fabric version is: ${global.fabricVersion}`); + console.log(`Used network config: ${fabloConfigPath}`); + console.log(`Fabric version is: ${global.fabricVersion}`); this._copyGitIgnore(); @@ -49,9 +49,9 @@ export default class SetupDockerGenerator extends Generator { this._copyHooks(config.hooks); this.on("end", () => { - this.log("Done & done !!! Try the network out: "); - this.log("-> fablo up - to start network"); - this.log("-> fablo help - to view all commands"); + console.log("Done & done !!! Try the network out: "); + console.log("-> fablo up - to start network"); + console.log("-> fablo help - to view all commands"); }); } diff --git a/src/validate/index.ts b/src/validate/index.ts index d25fcf554..98c80bca0 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -74,8 +74,8 @@ class ValidateGenerator extends Generator { }); this.addListener(validationErrorType.CRITICAL, (event) => { - this.log(chalk.bold.bgRed("Critical error occured:")); - this.log(chalk.bold(`- ${event.message}`)); + console.log(chalk.bold.bgRed("Critical error occured:")); + console.log(chalk.bold(`- ${event.message}`)); this._printIfNotEmpty(this.errors.getAllMessages(), chalk.red.bold("Errors found:")); process.exit(1); }); @@ -123,19 +123,19 @@ class ValidateGenerator extends Generator { } async shortSummary() { - this.log(`Validation errors count: ${this.errors.count()}`); - this.log(`Validation warnings count: ${this.warnings.count()}`); - this.log(chalk.bold("===========================================================")); + console.log(`Validation errors count: ${this.errors.count()}`); + console.log(`Validation warnings count: ${this.warnings.count()}`); + console.log(chalk.bold("===========================================================")); } async detailedSummary() { const allValidationMessagesCount = this.errors.count() + this.warnings.count(); if (allValidationMessagesCount > 0) { - this.log(chalk.bold("=================== Validation summary ====================")); + console.log(chalk.bold("=================== Validation summary ====================")); this._printIfNotEmpty(this.errors.getAllMessages(), chalk.red.bold("Errors found:")); this._printIfNotEmpty(this.warnings.getAllMessages(), chalk.yellow("Warnings found:")); - this.log(chalk.bold("===========================================================")); + console.log(chalk.bold("===========================================================")); } if (this.errors.count() > 0) { @@ -179,13 +179,13 @@ class ValidateGenerator extends Generator { _printIfNotEmpty(messages: Message[], caption: string) { if (messages.length > 0) { - this.log(caption); + console.log(caption); const grouped: Record = _.groupBy(messages, (msg) => msg.category); Object.keys(grouped).forEach((key) => { - this.log(chalk.bold(` ${key}:`)); - grouped[key].forEach((msg) => this.log(` - ${msg.message}`)); + console.log(chalk.bold(` ${key}:`)); + grouped[key].forEach((msg) => console.log(` - ${msg.message}`)); }); } } diff --git a/src/version/index.ts b/src/version/index.ts index b3cfe7795..e5b1680e9 100644 --- a/src/version/index.ts +++ b/src/version/index.ts @@ -12,9 +12,9 @@ export default class VersionGenerator extends Generator { async printVersion(): Promise { if (typeof this.options.verbose !== "undefined") { - this.log(JSON.stringify(fullInfo(), null, 2)); + console.log(JSON.stringify(fullInfo(), null, 2)); } else { - this.log(JSON.stringify(basicInfo(), null, 2)); + console.log(JSON.stringify(basicInfo(), null, 2)); } } } From 017efdfa4bbb2f52b5b9ea1ca06333505c3c0697 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 19:40:42 +0200 Subject: [PATCH 017/471] Fix import path Signed-off-by: Jakub Dzikowski --- e2e/fabloCommands.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 0467df2e6..e98c375aa 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -1,6 +1,6 @@ import TestCommands from "./TestCommands"; import { version as currentFabloVersion } from "../package.json"; -import { FabloConfigJson } from "../generators/types/FabloConfigJson"; +import { FabloConfigJson } from "../src/types/FabloConfigJson"; import * as fs from "fs"; const commands = new TestCommands("e2e/__tmp__/commands-tests"); From e59a47d678d14a1f18b295e8ff06d9d3d35d5754 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 19:55:16 +0200 Subject: [PATCH 018/471] Update snapshots Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/extendConfig.test.ts.snap | 786 ++++++++++++++++++++ 1 file changed, 786 insertions(+) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 4c88a8589..a926ccf3f 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -8926,3 +8926,789 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. ], } `; + +exports[`extend config samples/invalid-fablo-config.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": undefined, + "initRequired": false, + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_0", + "channel": "V2_0", + "isV2": true, + "isV3": false, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "2.3.3", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "2.3.3", + "fabricJavaenvVersion": "2.3", + "fabricNodeenvVersion": "2.3", + "fabricRecommendedNodeVersion": "12", + "fabricVersion": "2.3.3", + "monitoring": { + "loglevel": "info", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": { + "explorer": { + "address": "explorer.example.com", + "port": 7010, + }, + }, + }, + "hooks": { + "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "SOME-ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "SOME-ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-some-org1", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "some-org1", + "name": "some-org1", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + ], +} +`; From 359f713a0abf257ce5744c2c38dd0acef851ef39 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 20:09:23 +0200 Subject: [PATCH 019/471] Fix linting Signed-off-by: Jakub Dzikowski --- e2e/fabloCommands.test.ts | 3 ++- src/extend-config/extendGlobal.ts | 5 ++--- src/types/FabloConfigExtended.ts | 2 -- src/validate/index.ts | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index e98c375aa..65a893d79 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -111,10 +111,11 @@ describe("validate", () => { // Given const sourceConfigPath = require.resolve("../samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json"); const samplesDir = sourceConfigPath.replace("/fablo-config-hlf2-1org-1chaincode-raft-explorer.json", ""); + // eslint-disable-next-line @typescript-eslint/no-var-requires const sourceConfig = require(sourceConfigPath) as FabloConfigJson; // old schema - sourceConfig.$schema = "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json" + sourceConfig.$schema = "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json"; // invalid org sourceConfig.orgs[0].organization.mspName = "some-org1"; diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 86fe31fff..9cd63d378 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -5,14 +5,13 @@ import { GlobalJson } from "../types/FabloConfigJson"; import defaults from "./defaults"; const getNetworkCapabilities = (fabricVersion: string): Capabilities => { - if (version(fabricVersion).isGreaterOrEqual("2.5.0") && !version(fabricVersion).isGreaterOrEqual("3.0.0")) return { channel: "V2_0", orderer: "V2_0", application: "V2_5", isV2: true, isV3: false }; if (version(fabricVersion).isGreaterOrEqual("3.0.0")) - return { channel: "V3_0", orderer: "V2_0", application: "V2_5", isV2: false, isV3: true}; + return { channel: "V3_0", orderer: "V2_0", application: "V2_5", isV2: false, isV3: true }; - return { channel: "V2_0", orderer: "V2_0", application: "V2_0", isV2: true , isV3: false}; + return { channel: "V2_0", orderer: "V2_0", application: "V2_0", isV2: true, isV3: false }; }; const getVersions = (fabricVersion: string): FabricVersions => { diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index f6b75fd21..a4cc35f1b 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -16,7 +16,6 @@ interface CapabilitiesV2 { isV3: false; } - interface CapabilitiesV_2_5 { application: "V2_5"; channel: "V2_0"; @@ -33,7 +32,6 @@ interface CapabilitiesV3_0 { isV3: true; } - export type Capabilities = CapabilitiesV2 | CapabilitiesV_2_5 | CapabilitiesV3_0; export interface Global extends FabricVersions { diff --git a/src/validate/index.ts b/src/validate/index.ts index 98c80bca0..3d8a3b883 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -466,12 +466,12 @@ class ValidateGenerator extends Generator { _validateDevMode(global: GlobalJson): void { if (global.peerDevMode && global.tls) { - const message = `TLS needs to be disabled when running peers in dev mode`; - this.emit(validationErrorType.ERROR, { category: validationCategories.GENERAL, message }); + const message = `TLS needs to be disabled when running peers in dev mode`; + this.emit(validationErrorType.ERROR, { category: validationCategories.GENERAL, message }); } } - _verifyFabricVersion(global:GlobalJson){ + _verifyFabricVersion(global: GlobalJson) { if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { const message = `Fablo supports Fabric in version 2.0.0 and higher`; this.emit(validationErrorType.ERROR, { category: validationCategories.GENERAL, message }); From fda69c0ca6c7744370fe7240a38147fe022b3d42 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:03:44 +0530 Subject: [PATCH 020/471] version 3 changes initiated Signed-off-by: Sanket Teli --- .../fabric-docker/commands-generated.sh | 15 +++++++++++ .../fabric-docker/scripts/base-functions.sh | 25 ++++++++++++++++--- .../fabric-docker/scripts/cli/channel_fns.sh | 17 ++++++++++++- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 648f046d0..f311f10ee 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -50,9 +50,24 @@ installChannels() { <% if(!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + + <% if (global.capabilities.isV3) { -%> + #wait for channel creation + sleep 5 + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } else { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% if (global.capabilities.isV3) { -%> + #wait for channel creation + sleep 5 + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTLS '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } %> <% } else { -%> printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh index e089bb320..a9e08639e 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh @@ -95,9 +95,15 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + <% if(global.capabilities.isV3){ %> + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + <% } else { %> + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + <% } %> + removeContainer $CONTAINER_NAME } @@ -110,7 +116,18 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + # Assuming 'global_capabilities_isV3' is a predefined variable + <% if(global_capabilities_isV3) {%> + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.pb" + <% } else { %> + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" + <% } %> + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -133,11 +150,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \ --configPath ./fabric-config \ -profile "${CONFIG_PROFILE}" \ - -outputAnchorPeersUpdate ./config/"${MSP_NAME}"anchors.tx \ + -outputAnchorPeersUpdate "${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}"\ -channelID "${CHANNEL_NAME}" \ -asOrg "${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh index f96d6e4cb..a9ddfa31b 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh @@ -21,10 +21,19 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" + <% if(global.capabilities.isV3) { %> cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - + } + <% } else { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + <% } %> + + <% if(global.capabilities.isV3) { %> + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" + <% } else { %> peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block + <% } %> rm -rf "$DIR_NAME" } @@ -56,11 +65,17 @@ createChannelAndJoinTls() { echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" mkdir "$DIR_NAME" && cd "$DIR_NAME" + + <% if(global.capabilities.isV3) { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" + <% } else { %> cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + <% } %> rm -rf "$DIR_NAME" } From 12a771e849e2e61e315c0f40a18be77a414b08cc Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:27:45 +0530 Subject: [PATCH 021/471] added the tests Signed-off-by: Sanket Teli --- e2e-network/docker/test-05.sh | 93 +++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 e2e-network/docker/test-05.sh diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh new file mode 100644 index 000000000..808b6336f --- /dev/null +++ b/e2e-network/docker/test-05.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +set -eux + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "$6") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" +waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 4 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":6" + +# Reset and ensure the state is lost after reset +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) +waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"error\":\"NOT_FOUND\"}' + +# Put some data again +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "James Bond"]}' \ + '{\"success\":\"OK\"}' \ No newline at end of file From 4ab5d23445881fe9b5927b95ada640f3fad1016a Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:30:24 +0530 Subject: [PATCH 022/471] added the samples Signed-off-by: Sanket Teli --- .../fablo-config-hlf3-1orgs-1chaincode.json | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 samples/fablo-config-hlf3-1orgs-1chaincode.json diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json new file mode 100644 index 000000000..2a001c1cf --- /dev/null +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "global": { + "fabricVersion": "3.0.0-beta", + "tls": true, + "monitoring": { + "loglevel": "debug" + } + }, + "orgs": [ + { + "organization": { + "name": "Orderer", + "domain": "orderer.example.com" + }, + "orderers": [ + { + "groupName": "group1", + "type": "raft", + "instances": 1 + } + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "peer": { + "instances": 2, + "db": "LevelDb" + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0", + "peer1" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ] + } + \ No newline at end of file From 6760205a6164be02bd08908d4ab59b75dca9ce52 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 21:45:28 +0530 Subject: [PATCH 023/471] updated some conditions Signed-off-by: Sanket Teli --- e2e-network/docker/test-05.sh | 0 .../templates/fabric-docker/commands-generated.sh | 6 +----- .../templates/fabric-docker/docker-compose.yaml | 1 + .../templates/fabric-docker/scripts/cli/channel_fns.sh | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) mode change 100644 => 100755 e2e-network/docker/test-05.sh diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh old mode 100644 new mode 100755 diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index f311f10ee..322445e66 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -155,11 +155,7 @@ upgradeChaincode() { <% chaincodes.forEach((chaincode) => { -%> if [ "$chaincodeName" = "<%= chaincode.name %>" ]; then if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> - <% } else { -%> - <%- include('commands-generated/chaincode-upgrade-v2.sh', { chaincode, global }); %> - <% } -%> + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' upgrade. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 2ec40b3d3..d5fbb033a 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -209,6 +209,7 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 <%_ } _%> working_dir: /var/hyperledger/orderer command: orderer diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh index a9ddfa31b..374f31258 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh @@ -22,8 +22,7 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" <% if(global.capabilities.isV3) { %> - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - } + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . <% } else { %> cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . <% } %> From b810a148713997f1a15243bf4be5c6927f58f1c2 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Wed, 6 Nov 2024 19:17:24 +0530 Subject: [PATCH 024/471] updated the templates, now version 3 is supported Signed-off-by: Sanket Teli --- .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- src/extend-config/extendOrgsConfig.ts | 1 + src/setup-docker/index.ts | 13 +- .../templates/fabric-config/configtx.yaml | 6 +- .../{fabric-docker.sh => fabric-docker-v2.sh} | 0 .../templates/fabric-docker-v3.sh | 65 +++++ src/setup-docker/templates/fabric-docker/.env | 9 +- .../fabric-docker/commands-generated.sh | 62 +++-- .../fabric-docker/docker-compose.yaml | 1 + ...base-functions.sh => base-functions-v2.sh} | 21 +- .../scripts/base-functions-v3.sh | 263 ++++++++++++++++++ .../cli/{channel_fns.sh => channel_fns-v2.sh} | 17 +- .../scripts/cli/channel_fns-v3.sh | 123 ++++++++ src/types/FabloConfigExtended.ts | 1 + 14 files changed, 517 insertions(+), 67 deletions(-) rename src/setup-docker/templates/{fabric-docker.sh => fabric-docker-v2.sh} (100%) create mode 100755 src/setup-docker/templates/fabric-docker-v3.sh rename src/setup-docker/templates/fabric-docker/scripts/{base-functions.sh => base-functions-v2.sh} (90%) create mode 100644 src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh rename src/setup-docker/templates/fabric-docker/scripts/cli/{channel_fns.sh => channel_fns-v2.sh} (87%) create mode 100644 src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 2a001c1cf..f20b46de1 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, diff --git a/src/extend-config/extendOrgsConfig.ts b/src/extend-config/extendOrgsConfig.ts index 264aa911c..c2661f20e 100644 --- a/src/extend-config/extendOrgsConfig.ts +++ b/src/extend-config/extendOrgsConfig.ts @@ -61,6 +61,7 @@ const extendOrderersConfig = ( orgMspName, domain: ordererOrgDomainJson, consensus, + adminPort: 7053, port, fullAddress: `${address}:${port}`, }; diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 560eb1e8a..762b3f567 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -213,20 +213,15 @@ export default class SetupDockerGenerator extends Generator { } _copyUtilityScripts(capabilities: Capabilities): void { - this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); + this.fs.copyTpl(this.templatePath(`fabric-docker-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/cli/channel_fns.sh"), + this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), ); this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/cli/channel_fns.sh"), - this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), - ); - - this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/base-functions.sh"), + this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker/scripts/base-functions.sh"), ); @@ -241,7 +236,7 @@ export default class SetupDockerGenerator extends Generator { ); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/chaincode-functions-${capabilities.isV2 ? "v2" : "v1.4"}.sh`), + this.templatePath(`fabric-docker/scripts/chaincode-functions-${capabilities.isV2 ? "v2" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/chaincode-functions.sh"), ); } diff --git a/src/setup-docker/templates/fabric-config/configtx.yaml b/src/setup-docker/templates/fabric-config/configtx.yaml index c3f81a43d..95c5d4d0f 100755 --- a/src/setup-docker/templates/fabric-config/configtx.yaml +++ b/src/setup-docker/templates/fabric-config/configtx.yaml @@ -158,19 +158,23 @@ Profiles: <%_ channel.ordererGroup.hostingOrgs.forEach(function(hostingOrg) { _%> - *<%= hostingOrg %> <%_ }) _%> + <%_ if (!global.capabilities.isV3) { _%> Capabilities: <<: *ApplicationCapabilities + <%_ } _%> Consortium: SampleConsortium + <%_ if (!global.capabilities.isV3) { _%> Consortiums: SampleConsortium: Organizations: <%_ channel.orgs.forEach(function(org){ _%> - *<%= org.name %> <%_ }) _%> + <%_ } _%> Application: <<: *ApplicationDefaults Organizations: <%_ channel.orgs.forEach(function(org){ _%> - *<%= org.name %> <%_ }) _%> - <%_ }) _%> + <%_ }) _%> \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker.sh b/src/setup-docker/templates/fabric-docker-v2.sh similarity index 100% rename from src/setup-docker/templates/fabric-docker.sh rename to src/setup-docker/templates/fabric-docker-v2.sh diff --git a/src/setup-docker/templates/fabric-docker-v3.sh b/src/setup-docker/templates/fabric-docker-v3.sh new file mode 100755 index 000000000..db605e0a2 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker-v3.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index 90880f6af..1fef13821 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -17,9 +17,12 @@ FABRIC_CA_VERSION=<%= global.fabricCaVersion %> FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %> -FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %> -FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %> -RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %> + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 322445e66..5842909e9 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -41,37 +41,54 @@ generateChannelsArtifacts() { installChannels() { <% if (!channels || !channels.length) { -%> echo "No channels" - <% } else { -%> + <% } else if (global.capabilities.isV3) { -%> <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> - <% if(orgNo == 0 && peerNo == 0) { -%> + <% if (orgNo == 0 && peerNo == 0) { -%> printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" - <% if(!global.tls) { -%> + <% if (!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" - - <% if (global.capabilities.isV3) { -%> - #wait for channel creation + "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" sleep 5 - docker exec -i <%= org.cli.address %> bash -c <% -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" - <% } -%> - <% } else { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" - <% if (global.capabilities.isV3) { -%> - #wait for channel creation + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" sleep 5 - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; fetchChannelAndJoinTLS '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" - <% } -%> - + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" <% } %> <% } else { -%> - printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" - <% if(!global.tls) { -%> + printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" + <% if (!global.tls) { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } else { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } -%> + <% }) -%> + <% }) -%> + <% }) -%> + <% } else { -%> + <% channels.forEach((channel) => { -%> + <% channel.orgs.forEach((org, orgNo) => { -%> + <% org.peers.forEach((peer, peerNo) => { -%> + <% if (orgNo == 0 && peerNo == 0) { -%> + printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" + <% if (!global.tls) { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } else { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% } %> + <% } else { -%> + printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" + <% if (!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" <% } else { -%> @@ -85,20 +102,19 @@ installChannels() { <% } -%> } + installChaincodes() { <% if (!chaincodes || !chaincodes.length) { -%> echo "No chaincodes" <% } else { -%> <% chaincodes.forEach((chaincode) => { -%> if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> <% if (global.peerDevMode) { -%> <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> <% } else { -%> local version="<%= chaincode.version %>" <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> <% } -%> - <% } -%> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" @@ -117,9 +133,7 @@ installChaincode() { <% chaincodes.forEach((chaincode) => { -%> if [ "$chaincodeName" = "<%= chaincode.name %>" ]; then if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> - <% } -%> + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' install. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index d5fbb033a..08413f723 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -243,6 +243,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=${LOGGING_LEVEL} diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh similarity index 90% rename from src/setup-docker/templates/fabric-docker/scripts/base-functions.sh rename to src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index a9e08639e..b3aef4836 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -96,13 +96,9 @@ createChannelTx() { docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - <% if(global.capabilities.isV3){ %> - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - <% } else { %> + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - <% } %> removeContainer $CONTAINER_NAME @@ -117,16 +113,11 @@ createNewChannelUpdateTx() { local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - # Assuming 'global_capabilities_isV3' is a predefined variable - <% if(global_capabilities_isV3) {%> - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" - CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.pb" - <% } else { %> - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" - <% } %> + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh new file mode 100644 index 000000000..f24fce658 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -0,0 +1,263 @@ +#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "${dir}"/*_sk "${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".pb + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" + docker cp $CONTAINER_NAME:/config/channel.pb "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" + + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \ + --configPath ./fabric-config \ + -profile "${CONFIG_PROFILE}" \ + -outputAnchorPeersUpdate "${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}"\ + -channelID "${CHANNEL_NAME}" \ + -asOrg "${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \ + "$CLI_NAME" peer channel update \ + -c "$CHANNEL_NAME" \ + -o "$ORDERER_URL" \ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \ + "$CLI_NAME" peer channel update \ + -c "$CHANNEL_NAME" \ + -o "$ORDERER_URL" \ + -f "$ANCHOR_PEER_UPDATE_PATH" \ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\e[1m' + end=$'\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "${bold}============ %b %s %b ==============${end}\n" "\\$EMOJI" "$TEXT" "\\$EMOJI" +} + +printItalics() { + italics=$'\e[3m' + end=$'\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "${italics}==== %b %s %b ====${end}\n" "\\$EMOJI" "$TEXT" "\\$EMOJI" +} + +inputLog() { + end=$'\e[0m' + darkGray=$'\e[90m' + + echo "${darkGray} $1 ${end}" +} + +inputLogShort() { + end=$'\e[0m' + darkGray=$'\e[90m' + + echo "${darkGray} $1 ${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh similarity index 87% rename from src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh rename to src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh index 374f31258..fad11a6fe 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh @@ -21,18 +21,10 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - <% if(global.capabilities.isV3) { %> - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . - <% } else { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - <% } %> - - <% if(global.capabilities.isV3) { %> - osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" - <% } else { %> peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block - <% } %> rm -rf "$DIR_NAME" } @@ -65,16 +57,13 @@ createChannelAndJoinTls() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - <% if(global.capabilities.isV3) { %> - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . - osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" - <% } else { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - <% } %> + rm -rf "$DIR_NAME" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh new file mode 100644 index 000000000..88be1167c --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" + peer channel join -b "${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index a4cc35f1b..266f433ad 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -47,6 +47,7 @@ export interface OrdererConfig { name: string; domain: string; address: string; + adminPort: number; port: number; fullAddress: string; orgName: string; From 1b922e0d48d7966ff14bad993f5f5d743d8ae7e4 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 13 Nov 2024 10:46:17 +0530 Subject: [PATCH 025/471] Successfully pass the tests Signed-off-by: Sanket --- e2e-network/docker/test-05.sh | 25 +++---- src/setup-docker/index.ts | 2 +- .../templates/fabric-docker-v3.sh | 65 ------------------- .../{fabric-docker-v2.sh => fabric-docker.sh} | 0 .../fabric-docker/commands-generated.sh | 13 +++- .../scripts/base-functions-v3.sh | 22 ++++--- 6 files changed, 34 insertions(+), 93 deletions(-) delete mode 100755 src/setup-docker/templates/fabric-docker-v3.sh rename src/setup-docker/templates/{fabric-docker-v2.sh => fabric-docker.sh} (100%) diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh index 808b6336f..94fa62801 100755 --- a/e2e-network/docker/test-05.sh +++ b/e2e-network/docker/test-05.sh @@ -6,6 +6,8 @@ TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." +export FABLO_HOME + CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" networkUp() { @@ -36,7 +38,7 @@ waitForChaincode() { } expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "$6") + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") } expectCommand() { @@ -49,8 +51,8 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT # start the network networkUp -waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" -waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" @@ -71,23 +73,12 @@ expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 4 my-channel1 org1 peer1 "another.block") +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":6" +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" -# Reset and ensure the state is lost after reset -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) -waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"error\":\"NOT_FOUND\"}' - -# Put some data again -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "James Bond"]}' \ - '{\"success\":\"OK\"}' \ No newline at end of file +echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 762b3f567..36711d822 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -213,7 +213,7 @@ export default class SetupDockerGenerator extends Generator { } _copyUtilityScripts(capabilities: Capabilities): void { - this.fs.copyTpl(this.templatePath(`fabric-docker-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker.sh")); + this.fs.copyTpl(this.templatePath(`fabric-docker.sh`), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), diff --git a/src/setup-docker/templates/fabric-docker-v3.sh b/src/setup-docker/templates/fabric-docker-v3.sh deleted file mode 100755 index db605e0a2..000000000 --- a/src/setup-docker/templates/fabric-docker-v3.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker-v2.sh b/src/setup-docker/templates/fabric-docker.sh similarity index 100% rename from src/setup-docker/templates/fabric-docker-v2.sh rename to src/setup-docker/templates/fabric-docker.sh diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 5842909e9..8d1f81fe3 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -13,9 +13,14 @@ generateArtifacts() { <% }) -%> <%_ ordererGroups.forEach((ordererGroup) => { _%> + + <% if(!global.capabilities.isV3) {%> printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" - + <% } else { %> + echo "System channel not supported for Fabric version 3" + <% } %> + <%_ }) _%> # Create directory for chaincode packages to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" @@ -179,6 +184,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + <% if(!global.capabilities.isV3) { %> printHeadline "Creating new channel config blocks" "U1F537" <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org) => { -%> @@ -219,6 +225,11 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "<%= channel.name %>" "<%= org.mspName %>" "<%= org.cli.address %>" <% }) -%> <% }) -%> + + <% } else { %> + echo "" + <% } %> + } printStartSuccessInfo() { diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index f24fce658..27f572e33 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -77,7 +77,8 @@ createChannelTx() { local CONFIG_PATH=$2 local CONFIG_PROFILE=$3 local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".pb + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + echo CHNANEL_TX_PATH: $CHANNEL_TX_PATH echo "Creating channelTx for $CHANNEL_NAME..." inputLog "CONFIG_PATH: $CONFIG_PATH" @@ -91,17 +92,20 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker run --rm \ + --name $CONTAINER_NAME \ + -v "$CONFIG_PATH":/fabric-config \ + -v "$OUTPUT_PATH":/output \ + hyperledger/fabric-tools:"${FABRIC_VERSION}" \ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" - docker cp $CONTAINER_NAME:/config/channel.pb "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + echo "Channel configuration created at $CHANNEL_TX_PATH" - removeContainer $CONTAINER_NAME } createNewChannelUpdateTx() { From 6c55a7448a6d6e41fabd86d475522535360f551e Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 13 Nov 2024 12:05:54 +0530 Subject: [PATCH 026/471] updated testCases.md Signed-off-by: Sanket --- e2e-network/TEST_CASES.md | 40 +++++++++---------- .../{test-05.sh => test-05-version3.sh} | 0 2 files changed, 20 insertions(+), 20 deletions(-) rename e2e-network/docker/{test-05.sh => test-05-version3.sh} (100%) diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 247a98de7..80a71df03 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | -| TLS | no | yes | no | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | -| Consensus | solo | RAFT | solo | RAFT | -| Orderer nodes | 1 | 3 | 1 | 1 | -| Organizations | 1 | 2 | 2 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | -| Channels | 1 | 2 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | -| Private data | no | no | yes | yes | -| Java chaincode | no | yes | no | no | -| Go chaincode | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | +| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 1 | +| Organizations | 1 | 2 | 2 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | +| Private data | no | no | yes | yes | no | +| Java chaincode | no | yes | no | no | no | +| Go chaincode | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05-version3.sh similarity index 100% rename from e2e-network/docker/test-05.sh rename to e2e-network/docker/test-05-version3.sh From bb5cfcf612545c85ffbd13b98f6ec2f621ad4ca8 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Sun, 1 Dec 2024 23:37:31 +0530 Subject: [PATCH 027/471] increased the number of instances for the orderers Signed-off-by: Sanket Teli --- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index f20b46de1..1286f962e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -17,7 +17,7 @@ { "groupName": "group1", "type": "raft", - "instances": 1 + "instances": 3 } ] }, From 448c41c7ba314e862bdf827c7301e66f8333622e Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Mon, 2 Dec 2024 10:56:36 +0530 Subject: [PATCH 028/471] minor changes Signed-off-by: Sanket Teli --- .../fabric-docker/commands-generated.sh | 15 ++++++------- .../scripts/cli/channel_fns-v3.sh | 21 ++++++++----------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 8d1f81fe3..7e3d1717a 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -44,24 +44,26 @@ generateChannelsArtifacts() { } installChannels() { + set -x <% if (!channels || !channels.length) { -%> + echo "No channels" <% } else if (global.capabilities.isV3) { -%> <% channels.forEach((channel) => { -%> + <% channel.ordererGroup.orderers.forEach((orderer) => { -%> + <% const org = orgs.find((org) => org.name === orderer.orgName); -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' 'example.com' 'crypto/users/Admin@test/msp' '<%= orderer.address %>:<%= orderer.adminPort %>';" + <% }) -%> + sleep 8 <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" <% if (!global.tls) { -%> - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" - sleep 5 docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" <% } else { -%> - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" - sleep 5 docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" <% } %> @@ -107,7 +109,6 @@ installChannels() { <% } -%> } - installChaincodes() { <% if (!chaincodes || !chaincodes.length) { -%> echo "No chaincodes" diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 88be1167c..8f81e8824 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -33,14 +33,11 @@ createChannelAndJoinTls() { local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 + local ORDERER_URL=$5 - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + # local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + # local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + # local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -48,11 +45,11 @@ createChannelAndJoinTls() { echo " Orderer: $ORDERER_URL" echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + # echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + # echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + # echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + # echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + # echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" mkdir "$DIR_NAME" && cd "$DIR_NAME" From 06fd7de8305451e79dc2af76040d18899a9b83e7 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 13 Nov 2024 16:06:48 +0530 Subject: [PATCH 029/471] done with initial configuration for BFT, updated the templates for the same Signed-off-by: Sanket --- docs/schema.json | 3 +- e2e-network/docker/test-05-version3-BFT.sh | 84 +++++++++++++++++++ .../fablo-config-hlf3-1orgs-1chaincode.json | 4 +- ...ablo-config-hlf3-bft-1orgs-1chaincode.json | 60 +++++++++++++ .../configtx-raft-template.yaml.ejs | 12 +++ src/types/FabloConfigExtended.ts | 2 +- src/types/FabloConfigJson.ts | 2 +- 7 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 e2e-network/docker/test-05-version3-BFT.sh create mode 100644 samples/fablo-config-hlf3-bft-1orgs-1chaincode.json diff --git a/docs/schema.json b/docs/schema.json index fd5981002..2f411465c 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -224,7 +224,8 @@ "description": "The 'solo' consensus type may be used in development environment only. Use 'raft' in production.", "enum": [ "solo", - "raft" + "raft", + "BFT" ] }, "instances": { diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh new file mode 100644 index 000000000..b5d566dd6 --- /dev/null +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +set -eux + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +export FABLO_HOME + +CONFIG="$FABLO_HOME/fablo-config-hlf3-bft-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" + +echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 1286f962e..c56c53c18 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -16,8 +16,8 @@ "orderers": [ { "groupName": "group1", - "type": "raft", - "instances": 3 + "type": "BFT", + "instances": 4 } ] }, diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json new file mode 100644 index 000000000..8f90718a6 --- /dev/null +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -0,0 +1,60 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "global": { + "fabricVersion": "3.0.0-beta", + "tls": true, + "monitoring": { + "loglevel": "debug" + } + }, + "orgs": [ + { + "organization": { + "name": "Orderer", + "domain": "orderer.example.com" + }, + "orderers": [ + { + "groupName": "group1", + "type": "BFT", + "instances": 4 + } + + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "peer": { + "instances": 2, + "db": "LevelDb" + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0", + "peer1" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ] + } + \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index 8f7ddc6f9..ef7ad0fee 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -6,3 +6,15 @@ ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt <% })} -%> + +<% if (ordererGroup.consensus == "BFT") { %> + smartBFT: + ConsenterMapping:<% ordererGroup.orderers.forEach(function(orderer, index) { %> + - ID: <%= index+1 %> + Host: <%= orderer.address %> + Port: <%= orderer.port %> + MSPID: <%= orderer.orgMspName %> + Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/tlscacerts/tlsca.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt +<% })} -%> diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 266f433ad..3a20c75d9 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -160,7 +160,7 @@ export interface ChaincodeConfig { export interface OrdererGroup { name: string; - consensus: "solo" | "etcdraft"; + consensus: "solo" | "etcdraft" | "BFT"; profileName: string; genesisBlockName: string; configtxOrdererDefaults: string; diff --git a/src/types/FabloConfigJson.ts b/src/types/FabloConfigJson.ts index b2bb11eef..bc50f916b 100644 --- a/src/types/FabloConfigJson.ts +++ b/src/types/FabloConfigJson.ts @@ -21,7 +21,7 @@ export interface CAJson { export interface OrdererJson { groupName: string; prefix: string; - type: "solo" | "raft"; + type: "solo" | "raft" | "BFT"; instances: number; } From 3ded06441b9da1c7c54de47cb2d842c4fc41fe3f Mon Sep 17 00:00:00 2001 From: Sanket Date: Fri, 22 Nov 2024 09:23:28 +0530 Subject: [PATCH 030/471] updated the permission Signed-off-by: Sanket --- e2e-network/docker/test-05-version3-BFT.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 e2e-network/docker/test-05-version3-BFT.sh diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh old mode 100644 new mode 100755 From 4bf50077e90da1ed5096a24fd36e1394fe0ed17f Mon Sep 17 00:00:00 2001 From: Sanket Date: Fri, 22 Nov 2024 18:15:10 +0530 Subject: [PATCH 031/471] version 3 completed heading towards adding BFT support Signed-off-by: Sanket --- e2e-network/docker/test-05-version3-BFT.sh | 2 +- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- .../fabric-config/configtx-raft-template.yaml.ejs | 15 ++++++++++++++- .../fabric-docker/scripts/cli/channel_fns-v3.sh | 7 +++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index b5d566dd6..179d2c531 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -8,7 +8,7 @@ FABLO_HOME="$TEST_TMP/../../.." export FABLO_HOME -CONFIG="$FABLO_HOME/fablo-config-hlf3-bft-1orgs-1chaincode.json" +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json" networkUp() { "$FABLO_HOME/fablo-build.sh" diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index c56c53c18..467c2920e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -16,7 +16,7 @@ "orderers": [ { "groupName": "group1", - "type": "BFT", + "type": "raft", "instances": 4 } ] diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index ef7ad0fee..8218b70b8 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -8,7 +8,20 @@ <% })} -%> <% if (ordererGroup.consensus == "BFT") { %> - smartBFT: + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 ConsenterMapping:<% ordererGroup.orderers.forEach(function(orderer, index) { %> - ID: <%= index+1 %> Host: <%= orderer.address %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 8f81e8824..6eaf90ce5 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -33,18 +33,21 @@ createChannelAndJoinTls() { local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 + # local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + # local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + # local TLS_CA_CERT_PATH=$(realpath "$6") local ORDERER_URL=$5 # local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt # local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key # local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_LOCALMSPID echo "Creating channel with name (TLS): ${CHANNEL_NAME}" echo " Orderer: $ORDERER_URL" echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + # echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" # echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" # echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" # echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" From a29f37375a1ebb61d0b70b1e472e4008b8549339 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 10:10:34 +0100 Subject: [PATCH 032/471] Use proper createChannelAndJoinTls with certs Signed-off-by: Jakub Dzikowski --- .../fabric-docker/commands-generated.sh | 4 +- .../scripts/cli/channel_fns-v3.sh | 50 +++++++++---------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 7e3d1717a..7644abc36 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -53,9 +53,9 @@ installChannels() { <% channel.ordererGroup.orderers.forEach((orderer) => { -%> <% const org = orgs.find((org) => org.name === orderer.orgName); -%> docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' 'example.com' 'crypto/users/Admin@test/msp' '<%= orderer.address %>:<%= orderer.adminPort %>';" + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> - sleep 8 + sleep 8 # TODO: remove sleep <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 6eaf90ce5..1b51468aa 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -30,36 +30,34 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - # local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - # local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - # local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$5 - - # local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - # local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - # local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_LOCALMSPID + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME echo "Creating channel with name (TLS): ${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - # echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - # echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - # echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - # echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - # echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - # echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \ + --channelID "${CHANNEL_NAME}" \ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \ + -o "${ORDERER_ADMIN_ADDRESS}" \ + --client-cert "${ADMIN_TLS_SIGN_CERT}" \ + --client-key "${ADMIN_TLS_PRIVATE_KEY}" \ + --ca-file "${TLS_CA_CERT_PATH}" - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . - osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" - rm -rf "$DIR_NAME" } From 8987bdf0aaf5298bfbeceb14dca8b5b96f7746d0 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 10:19:48 +0100 Subject: [PATCH 033/471] Enable TLS for admin endpoints Signed-off-by: Jakub Dzikowski --- .../templates/fabric-docker/docker-compose.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 08413f723..1552ba3a1 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -189,6 +189,7 @@ services: - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=<%= orderer.port %> - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 <%_ if(global.capabilities.isV2) { _%> - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> <%_ } else { _%> @@ -203,13 +204,17 @@ services: - ORDERER_METRICS_PROVIDER=prometheus # enabled TLS - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] <%_ } _%> working_dir: /var/hyperledger/orderer command: orderer From 6cd3ea6bfa5002701316f9e39bada302901e6b8d Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:14:17 +0100 Subject: [PATCH 034/471] Reorder and fix docker compose variable for orderer Signed-off-by: Jakub Dzikowski --- .../fabric-docker/docker-compose.yaml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 1552ba3a1..3b93c52d5 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -188,34 +188,34 @@ services: - FABRIC_LOGGING_SPEC=${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=<%= orderer.port %> - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 - <%_ if(global.capabilities.isV2) { _%> - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> - <%_ } else { _%> - - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> - <%_ } _%> - - ORDERER_GENERAL_LOCALMSPID=<%= org.mspName %> + - ORDERER_GENERAL_LOCALMSPID=<%= orderer.orgMspName %> - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go <%_ if(global.tls) { _%> - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=<%= orderer.address %>:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + <%_ } _%> + <%_ if(global.capabilities.isV3) { _%> + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration - ORDERER_ADMIN_TLS_ENABLED=true - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:<%= orderer.adminPort %> <%_ } _%> + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=<%= orderer.address %>:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: From ca63af236b2cb7abc7eb7f0f058c53b7e8e36c68 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:14:39 +0100 Subject: [PATCH 035/471] Fix identity which remove NOT_FOUND error while fetching the channel Signed-off-by: Jakub Dzikowski --- .../templates/fabric-config/configtx-raft-template.yaml.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index 8218b70b8..73a4334f1 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -27,7 +27,7 @@ Host: <%= orderer.address %> Port: <%= orderer.port %> MSPID: <%= orderer.orgMspName %> - Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/tlscacerts/tlsca.orderer.example.com-cert.pem + Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/signcerts/<%= orderer.address %>-cert.pem ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt <% })} -%> From d6777f842c2254737697f821eab9fe686e713985 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:15:24 +0100 Subject: [PATCH 036/471] Remove unnecessary sleep Signed-off-by: Jakub Dzikowski --- src/setup-docker/templates/fabric-docker/commands-generated.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 7644abc36..cf717aa61 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -55,7 +55,6 @@ installChannels() { docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> - sleep 8 # TODO: remove sleep <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> From 1c2569c015e4cb1769b8475b1c1abd265165dda0 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:50:01 +0100 Subject: [PATCH 037/471] Fix docker compose variables for RAFT Signed-off-by: Jakub Dzikowski --- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 3b93c52d5..405052deb 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -201,6 +201,11 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] <%_ } _%> + <%_ if(ordererGroup.consensus !== "BFT" && global.capabilities.isV2) { _%> + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> + <%_ } _%> <%_ if(global.capabilities.isV3) { _%> # V3 specific settings - ORDERER_GENERAL_BOOTSTRAPMETHOD=none From 7d058533ca8a1e0987e1622716ec8c6a8f077f93 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:50:20 +0100 Subject: [PATCH 038/471] Some polishing and cleanup Signed-off-by: Jakub Dzikowski --- .../templates/fabric-docker/commands-generated.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index cf717aa61..15a12d994 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -15,10 +15,8 @@ generateArtifacts() { <%_ ordererGroups.forEach((ordererGroup) => { _%> <% if(!global.capabilities.isV3) {%> - printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" - <% } else { %> - echo "System channel not supported for Fabric version 3" + printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" <% } %> <%_ }) _%> @@ -44,9 +42,7 @@ generateChannelsArtifacts() { } installChannels() { - set -x <% if (!channels || !channels.length) { -%> - echo "No channels" <% } else if (global.capabilities.isV3) { -%> <% channels.forEach((channel) => { -%> @@ -55,6 +51,9 @@ installChannels() { docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> + <% if (channel.ordererGroup.consensus !== "BFT") { -%> + sleep 4 # Wait for Raft cluster to establish consensus + <% } -%> <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> From 84b6a0829c3705d84612be3a6af6b5bd6d43a009 Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:39:26 +0530 Subject: [PATCH 039/471] Update src/setup-docker/templates/fabric-docker/docker-compose.yaml Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> --- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 405052deb..e26060fd3 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -201,7 +201,7 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] <%_ } _%> - <%_ if(ordererGroup.consensus !== "BFT" && global.capabilities.isV2) { _%> + <%_ if(global.capabilities.isV2) { _%> # Genesis file configuration (for solo and raft) - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> From 1db4d30327c1acac7fe4f9385b0509f904e1b19a Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 12:45:53 +0530 Subject: [PATCH 040/471] updated the snapshots Signed-off-by: Sanket Teli --- e2e/__snapshots__/extendConfig.test.ts.snap | 2147 +++++++++++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 40 +- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 36 +- ...2chaincodes-private-data.yaml.test.ts.snap | 41 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 99 +- ...1chaincode-raft-explorer.json.test.ts.snap | 160 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 56 + e2e/__snapshots__/schema.test.ts.snap | 1 + samples/invalid-fablo-config.json | 2 +- 9 files changed, 2432 insertions(+), 150 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index a926ccf3f..84c005f6b 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -103,6 +103,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -114,6 +115,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -126,6 +128,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -139,6 +142,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -435,6 +439,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -446,6 +451,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -458,6 +464,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -471,6 +478,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -603,6 +611,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -623,6 +632,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -634,6 +644,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -646,6 +657,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -692,6 +704,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -704,6 +717,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -914,6 +928,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -925,6 +940,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -937,6 +953,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -950,6 +967,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1246,6 +1264,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1257,6 +1276,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1269,6 +1289,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1282,6 +1303,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1414,6 +1436,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1434,6 +1457,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1445,6 +1469,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1457,6 +1482,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1503,6 +1529,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1515,6 +1542,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1720,6 +1748,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1731,6 +1760,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1743,6 +1773,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1756,6 +1787,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2037,6 +2069,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2048,6 +2081,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2060,6 +2094,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2073,6 +2108,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2205,6 +2241,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2225,6 +2262,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2236,6 +2274,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2248,6 +2287,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2294,6 +2334,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2306,6 +2347,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2511,6 +2553,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2522,6 +2565,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2534,6 +2578,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2547,6 +2592,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2915,6 +2961,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2926,6 +2973,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2938,6 +2986,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2951,6 +3000,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3320,6 +3370,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3331,6 +3382,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3343,6 +3395,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3356,6 +3409,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3551,6 +3605,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3571,6 +3626,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3582,6 +3638,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3594,6 +3651,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3640,6 +3698,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3652,6 +3711,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3930,6 +3990,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3941,6 +4002,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3953,6 +4015,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3963,6 +4026,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -3973,6 +4037,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -3986,6 +4051,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4371,6 +4437,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4382,6 +4449,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4394,6 +4462,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4404,6 +4473,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -4414,6 +4484,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -4427,6 +4498,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4813,6 +4885,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4824,6 +4897,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4836,6 +4910,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4846,6 +4921,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -4856,6 +4932,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -4869,6 +4946,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5152,6 +5230,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5163,6 +5242,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5175,6 +5255,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5185,6 +5266,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5195,6 +5277,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -5208,6 +5291,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5503,6 +5587,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group2", "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5514,6 +5599,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5526,6 +5612,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5539,6 +5626,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5775,6 +5863,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5785,6 +5874,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5805,6 +5895,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5816,6 +5907,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5828,6 +5920,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5838,6 +5931,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5848,6 +5942,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -5869,6 +5964,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group2", "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5880,6 +5976,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5892,6 +5989,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5938,6 +6036,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5950,6 +6049,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5960,6 +6060,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5970,6 +6071,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -6019,6 +6121,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -6031,6 +6134,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -6316,6 +6420,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6328,6 +6433,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6338,6 +6444,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6393,6 +6500,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6404,6 +6512,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6414,6 +6523,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6424,6 +6534,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -6434,6 +6545,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -6446,6 +6558,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6456,6 +6569,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -6466,6 +6580,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6476,6 +6591,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6486,6 +6602,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -6496,6 +6613,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -6506,6 +6624,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -6516,6 +6635,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -6529,6 +6649,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6607,6 +6728,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6619,6 +6741,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6629,6 +6752,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6745,6 +6869,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6757,6 +6882,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6767,6 +6893,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6886,6 +7013,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6898,6 +7026,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6908,6 +7037,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6963,6 +7093,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6974,6 +7105,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6984,6 +7116,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6994,6 +7127,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7004,6 +7138,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7016,6 +7151,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7026,6 +7162,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7036,6 +7173,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7046,6 +7184,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7056,6 +7195,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7066,6 +7206,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7076,6 +7217,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7086,6 +7228,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7099,6 +7242,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7177,6 +7321,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7189,6 +7334,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7199,6 +7345,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7313,6 +7460,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7325,6 +7473,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7335,6 +7484,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7390,6 +7540,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7401,6 +7552,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7411,6 +7563,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7421,6 +7574,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7431,6 +7585,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7443,6 +7598,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7453,6 +7609,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7463,6 +7620,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7473,6 +7631,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7483,6 +7642,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7493,6 +7653,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7503,6 +7664,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7513,6 +7675,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7526,6 +7689,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7604,6 +7768,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7616,6 +7781,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7626,6 +7792,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7740,6 +7907,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7752,6 +7920,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7762,6 +7931,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7817,6 +7987,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7828,6 +7999,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7838,6 +8010,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7848,6 +8021,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7858,6 +8032,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7870,6 +8045,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7880,6 +8056,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7890,6 +8067,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7900,6 +8078,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7910,6 +8089,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7920,6 +8100,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7930,6 +8111,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7940,6 +8122,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7953,6 +8136,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8031,6 +8215,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8043,6 +8228,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8053,6 +8239,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8163,6 +8350,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8175,6 +8363,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8185,6 +8374,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8267,6 +8457,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8277,6 +8468,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8287,6 +8479,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8297,6 +8490,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8320,6 +8514,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8331,6 +8526,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8341,6 +8537,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8351,6 +8548,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8361,6 +8559,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8373,6 +8572,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8383,6 +8583,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -8393,6 +8594,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8403,6 +8605,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8413,6 +8616,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8423,6 +8627,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8433,6 +8638,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8443,6 +8649,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -8489,6 +8696,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8501,6 +8709,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8511,6 +8720,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -8596,6 +8806,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8608,6 +8819,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8618,6 +8830,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8728,6 +8941,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8740,6 +8954,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8750,6 +8965,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8860,6 +9076,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8872,6 +9089,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8882,6 +9100,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -8927,6 +9146,1920 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. } `; +exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": "AND ('Org1MSP.member')", + "init": "{"Args":[]}", + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_5", + "channel": "V3_0", + "isV2": false, + "isV3": true, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "3.0.0-beta", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "3.0.0-beta", + "fabricJavaenvVersion": "3.0", + "fabricNodeenvVersion": "3.0", + "fabricRecommendedNodeVersion": "16", + "fabricVersion": "3.0.0-beta", + "monitoring": { + "loglevel": "debug", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": {}, + }, + "hooks": { + "postGenerate": "", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "ORDERER_CA_ADMIN_NAME", + "caAdminPassVar": "ORDERER_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-orderer", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "OrdererMSP", + "name": "Orderer", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], +} +`; + +exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": "AND ('Org1MSP.member')", + "init": "{"Args":[]}", + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_5", + "channel": "V3_0", + "isV2": false, + "isV3": true, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "3.0.0-beta", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "3.0.0-beta", + "fabricJavaenvVersion": "3.0", + "fabricNodeenvVersion": "3.0", + "fabricRecommendedNodeVersion": "16", + "fabricVersion": "3.0.0-beta", + "monitoring": { + "loglevel": "debug", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": {}, + }, + "hooks": { + "postGenerate": "", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "ORDERER_CA_ADMIN_NAME", + "caAdminPassVar": "ORDERER_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-orderer", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "OrdererMSP", + "name": "Orderer", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], +} +`; + exports[`extend config samples/invalid-fablo-config.json 1`] = ` { "chaincodes": [ @@ -9025,6 +11158,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9036,6 +11170,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9048,6 +11183,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9061,6 +11197,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9342,6 +11479,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9353,6 +11491,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9365,6 +11504,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9378,6 +11518,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9510,6 +11651,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9530,6 +11672,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9541,6 +11684,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9553,6 +11697,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9599,6 +11744,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9611,6 +11757,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e86497d72..e13e09159 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1543,9 +1543,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 FABRIC_BASEOS_VERSION=2.3.3 -FABRIC_JAVAENV_VERSION=2.3 -FABRIC_NODEENV_VERSION=2.3 -RECOMMENDED_NODE_VERSION=12 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1715,6 +1718,7 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" @@ -1815,6 +1819,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -1823,6 +1828,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + } printStartSuccessInfo() { @@ -1927,22 +1933,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -2069,6 +2076,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2266,8 +2274,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -2281,7 +2289,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -2304,11 +2315,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -3065,7 +3076,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index b207f8f5d..dfc5ad03d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -117,6 +117,7 @@ Orderer: &Group1Defaults OrdererType: solo Addresses: - orderer0.group1.orderer.example.com:7030 + BatchTimeout: 2s BatchSize: MaxMessageCount: 10 @@ -1453,9 +1454,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 FABRIC_BASEOS_VERSION=2.5.9 -FABRIC_JAVAENV_VERSION=2.5 + + +FABRIC_JAVAENV_VERSION=3.0-beta FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=16 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1665,10 +1669,11 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" } @@ -1770,6 +1775,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -1778,6 +1784,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + } printStartSuccessInfo() { @@ -1881,11 +1888,14 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -1959,6 +1969,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2002,6 +2013,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2130,8 +2142,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -2145,7 +2157,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -2168,11 +2183,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -2929,7 +2944,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 33bc82dc4..9bc473251 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -168,6 +168,7 @@ Orderer: &Group1Defaults OrdererType: solo Addresses: - orderer0.group1.orderer.example.com:7030 + BatchTimeout: 2s BatchSize: MaxMessageCount: 10 @@ -2114,9 +2115,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 FABRIC_BASEOS_VERSION=2.4.7 -FABRIC_JAVAENV_VERSION=2.4 -FABRIC_NODEENV_VERSION=2.4 -RECOMMENDED_NODE_VERSION=16 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -2380,12 +2384,13 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" } @@ -2563,6 +2568,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel1" "Org2MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -2574,6 +2580,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel1" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -2712,11 +2719,14 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -2793,6 +2803,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2836,6 +2847,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2928,6 +2940,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -3056,8 +3069,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -3071,7 +3084,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -3094,11 +3110,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -3855,7 +3871,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 1f2d6803a..e203a90a9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -214,6 +214,7 @@ Orderer: &Group2Defaults OrdererType: solo Addresses: - orderer0.group2.orderer2.com:7050 + BatchTimeout: 2s BatchSize: MaxMessageCount: 1 @@ -3037,9 +3038,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 FABRIC_BASEOS_VERSION=2.4.3 -FABRIC_JAVAENV_VERSION=2.4 -FABRIC_NODEENV_VERSION=2.4 -RECOMMENDED_NODE_VERSION=16 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3494,24 +3498,25 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" - printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org2MSP' 'peer0.org2.example.com:7081' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" printHeadline "Creating 'my-channel2' on Org1/peer1" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel2' 'Org1MSP' 'peer1.org1.example.com:7062' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" - printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer1.org2.example.com:7082' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" printHeadline "Creating 'my-channel3' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer1.org1.example.com:7062' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer0.org2.example.com:7081' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer1.org2.example.com:7082' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" } @@ -3683,6 +3688,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel1" "Org2MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -3706,6 +3712,7 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "my-channel2" "Org2MSP" "cli.org2.example.com" deleteNewChannelUpdateTx "my-channel3" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel3" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -3839,22 +3846,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3874,22 +3882,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3909,22 +3918,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7032 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4002,22 +4012,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group2Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group2.orderer2.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group2Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group2.orderer2.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4126,6 +4137,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4174,6 +4186,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4282,6 +4295,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4330,6 +4344,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4463,8 +4478,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -4478,7 +4493,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -4501,11 +4519,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -5262,7 +5280,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index f6e7b7d26..91fed2897 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3333,9 +3333,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 FABRIC_BASEOS_VERSION=2.3.2 -FABRIC_JAVAENV_VERSION=2.3 -FABRIC_NODEENV_VERSION=2.3 -RECOMMENDED_NODE_VERSION=12 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3833,24 +3836,25 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" printHeadline "Creating 'my-channel2' on Org2/peer0" "U1F63B" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer1.org2.example.com:7062' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" printHeadline "Creating 'my-channel3' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer1.org2.example.com:7062' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" } @@ -3952,6 +3956,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel2" "Org2MSP" "MyChannel2" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -3969,6 +3974,7 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "my-channel2" "Org2MSP" "cli.org2.example.com" deleteNewChannelUpdateTx "my-channel3" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel3" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -4089,22 +4095,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4124,22 +4131,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4221,22 +4229,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org1.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org1.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4256,22 +4265,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7051 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org1.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org1.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4300,6 +4310,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4346,6 +4357,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4446,22 +4458,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7070 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org2.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org2.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4481,22 +4494,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7071 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org2.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org2.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4525,6 +4539,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4571,6 +4586,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4671,22 +4687,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7090 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org3MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org3.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org3.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4706,22 +4723,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7091 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org3MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org3.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org3.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4750,6 +4768,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4796,6 +4815,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4970,8 +4990,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -4985,7 +5005,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -5008,11 +5031,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -5769,7 +5792,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 10cdeed92..eea3f4ea4 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -49,6 +50,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -59,6 +61,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -69,6 +72,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -81,6 +85,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -92,6 +97,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -113,6 +119,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -125,6 +132,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -136,6 +144,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -149,6 +158,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -159,6 +169,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -204,6 +215,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -214,6 +226,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -224,6 +237,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -236,6 +250,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -284,6 +299,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -296,6 +312,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -686,6 +703,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -696,6 +714,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -706,6 +725,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -718,6 +738,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -729,6 +750,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -740,6 +762,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1025,6 +1048,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1035,6 +1059,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -1045,6 +1070,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -1057,6 +1083,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1068,6 +1095,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1079,6 +1107,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1388,6 +1417,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1400,6 +1430,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1411,6 +1442,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1422,6 +1454,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" }, @@ -1726,6 +1759,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1736,6 +1770,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -1746,6 +1781,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -1758,6 +1794,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1769,6 +1806,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1780,6 +1818,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2166,6 +2205,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2176,6 +2216,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -2186,6 +2227,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -2198,6 +2240,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -2209,6 +2252,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -2220,6 +2264,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2426,6 +2471,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", @@ -2472,6 +2518,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2484,6 +2531,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2495,6 +2543,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2508,6 +2557,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2553,6 +2603,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2565,6 +2616,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2771,6 +2823,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2783,6 +2836,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2794,6 +2848,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2805,6 +2860,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" }, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6923640c9..1613693ae 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -420,6 +420,7 @@ exports[`schema should match snapshot 1`] = ` "enum": [ "solo", "raft", + "BFT", ], "title": "Orderer type", "type": "string", diff --git a/samples/invalid-fablo-config.json b/samples/invalid-fablo-config.json index eefc9daef..32abdd3b2 100644 --- a/samples/invalid-fablo-config.json +++ b/samples/invalid-fablo-config.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", "global": { - "fabricVersion": "2.5.12", + "fabricVersion": "2.3.3", "tls": true, "tools": { "explorer": true From 80f8e94a1db9c15c57db7b63edf4a8760457d910 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 12:52:04 +0530 Subject: [PATCH 041/471] changed the log check message in BFT test file Signed-off-by: Sanket Teli --- e2e-network/docker/test-05-version3-BFT.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index 179d2c531..2a236749b 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -51,7 +51,7 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT # start the network networkUp -waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "orderer0.group1.orderer.example.com" "Channel created" waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" From e0012cb4a56e9b53d14e4c289b87fb6cd178a0b7 Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:57:30 +0530 Subject: [PATCH 042/471] Update src/setup-docker/index.ts Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> --- src/setup-docker/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 36711d822..18c064739 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -213,7 +213,7 @@ export default class SetupDockerGenerator extends Generator { } _copyUtilityScripts(capabilities: Capabilities): void { - this.fs.copyTpl(this.templatePath(`fabric-docker.sh`), this.destinationPath("fabric-docker.sh")); + this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), From e987ca8070b33cd987bcc55c83ecf3aa858fa936 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 15:25:20 +0530 Subject: [PATCH 043/471] minor changes Signed-off-by: Sanket Teli --- e2e-network/docker/test-05-version3-BFT.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index 2a236749b..967b10a3d 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -52,6 +52,9 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT networkUp waitForContainer "orderer0.group1.orderer.example.com" "Channel created" +waitForContainer "orderer1.group1.orderer.example.com" "Channel created" +waitForContainer "orderer2.group1.orderer.example.com" "Channel created" +waitForContainer "orderer3.group1.orderer.example.com" "Channel created" waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" From 7e9a5066a2d541c54947d6b5c79962beeb419cc2 Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:23:46 +0530 Subject: [PATCH 044/471] Update e2e-network/docker/test-05-version3-BFT.sh Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> --- e2e-network/docker/test-05-version3-BFT.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index 967b10a3d..42d3b5754 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eux +set -eu TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" From d5888ad55ea39139c7a2a238e95aba57fe55b8db Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:23:54 +0530 Subject: [PATCH 045/471] Update e2e-network/docker/test-05-version3.sh Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> --- e2e-network/docker/test-05-version3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-05-version3.sh b/e2e-network/docker/test-05-version3.sh index 94fa62801..5f08f5cf8 100755 --- a/e2e-network/docker/test-05-version3.sh +++ b/e2e-network/docker/test-05-version3.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eux +set -eu TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" From 137ce97e08db4c24dcb718d401142ef43d369969 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 16:26:19 +0530 Subject: [PATCH 046/471] minor fixes after the review Signed-off-by: Sanket Teli --- src/setup-docker/templates/fabric-docker/.env | 8 ++---- .../fabric-docker/commands-generated.sh | 28 +++++++++---------- .../scripts/base-functions-v2.sh | 6 ---- .../scripts/cli/channel_fns-v2.sh | 9 ------ 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index 1fef13821..bfdc840c8 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -18,11 +18,9 @@ FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %> - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %> +FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %> +RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %> ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 15a12d994..d9c4b023f 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -48,8 +48,8 @@ installChannels() { <% channels.forEach((channel) => { -%> <% channel.ordererGroup.orderers.forEach((orderer) => { -%> <% const org = orgs.find((org) => org.name === orderer.orgName); -%> - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> <% if (channel.ordererGroup.consensus !== "BFT") { -%> sleep 4 # Wait for Raft cluster to establish consensus @@ -113,12 +113,12 @@ installChaincodes() { <% } else { -%> <% chaincodes.forEach((chaincode) => { -%> if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.peerDevMode) { -%> - <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> - <% } else { -%> - local version="<%= chaincode.version %>" - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> - <% } -%> + <% if (global.peerDevMode) { -%> + <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> + <% } else { -%> + local version="<%= chaincode.version %>" + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> + <% } -%> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" @@ -199,22 +199,22 @@ notifyOrgsAboutChannels() { printHeadline "Notyfing orgs about channels" "U1F4E2" <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org) => { -%> - <% if(!global.tls) { -%> - notifyOrgAboutNewChannel <% -%> + <% if(!global.tls) { -%> + notifyOrgAboutNewChannel <% -%> "<%= channel.name %>" <% -%> "<%= org.mspName %>" <% -%> "<%= org.cli.address %>" <% -%> "peer0.<%= org.domain %>" <% -%> "<%= channel.ordererHead.fullAddress %>" - <% } else { -%> - notifyOrgAboutNewChannelTls <% -%> + <% } else { -%> + notifyOrgAboutNewChannelTls <% -%> "<%= channel.name %>" <% -%> "<%= org.mspName %>" <% -%> "<%= org.cli.address %>" <% -%> "peer0.<%= org.domain %>" <% -%> "<%= channel.ordererHead.fullAddress %>" <% -%> "crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem" - <% } -%> + <% } -%> <% }) -%> <% }) %> @@ -226,7 +226,7 @@ notifyOrgsAboutChannels() { <% }) -%> <% } else { %> - echo "" + echo "" <% } %> } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index b3aef4836..55f69fcfa 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -96,30 +96,24 @@ createChannelTx() { docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - removeContainer $CONTAINER_NAME } createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" inputLog "MSP_NAME: $MSP_NAME" diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh index fad11a6fe..46da0021c 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh @@ -4,11 +4,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -21,7 +19,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block @@ -31,7 +28,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -57,8 +53,6 @@ createChannelAndJoinTls() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" @@ -70,11 +64,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -95,7 +87,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") From 35d445330c4859b585374c17a3a95d06b9342912 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 16:31:51 +0530 Subject: [PATCH 047/471] updated the snapshots Signed-off-by: Sanket Teli --- ...rg-1chaincode-raft-explorer.json.test.ts.snap | 16 +++------------- ...config-hlf2-1org-1chaincode.json.test.ts.snap | 14 ++------------ ...gs-2chaincodes-private-data.yaml.test.ts.snap | 16 +++------------- ...hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 16 +++------------- ...gs-1chaincode-raft-explorer.json.test.ts.snap | 16 +++------------- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 -- 6 files changed, 14 insertions(+), 66 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e13e09159..c5a9def06 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1544,11 +1544,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 FABRIC_BASEOS_VERSION=2.3.3 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.3 +FABRIC_NODEENV_VERSION=2.3 +RECOMMENDED_NODE_VERSION=12 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1718,7 +1716,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" @@ -2283,7 +2280,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -3058,11 +3054,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3084,7 +3078,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3120,11 +3113,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3145,7 +3136,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index dfc5ad03d..3037eeb28 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1455,11 +1455,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 FABRIC_BASEOS_VERSION=2.5.9 - -FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1669,7 +1667,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" @@ -2151,7 +2148,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -2926,11 +2922,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -2952,7 +2946,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -2988,11 +2981,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3013,7 +3004,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 9bc473251..d92769a50 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2116,11 +2116,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 FABRIC_BASEOS_VERSION=2.4.7 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.4 +FABRIC_NODEENV_VERSION=2.4 +RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -2384,7 +2382,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" @@ -3078,7 +3075,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -3853,11 +3849,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3879,7 +3873,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3915,11 +3908,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3940,7 +3931,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index e203a90a9..bfe6401d5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3039,11 +3039,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 FABRIC_BASEOS_VERSION=2.4.3 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.4 +FABRIC_NODEENV_VERSION=2.4 +RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3498,7 +3496,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" @@ -4487,7 +4484,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -5262,11 +5258,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5288,7 +5282,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -5324,11 +5317,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5349,7 +5340,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 91fed2897..963c7b2fd 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3334,11 +3334,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 FABRIC_BASEOS_VERSION=2.3.2 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.3 +FABRIC_NODEENV_VERSION=2.3 +RECOMMENDED_NODE_VERSION=12 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3836,7 +3834,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" @@ -4999,7 +4996,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -5774,11 +5770,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5800,7 +5794,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -5836,11 +5829,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5861,7 +5852,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index eea3f4ea4..6f3aa8aff 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,7 +2470,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From a3843e332d74b1461d47ae90ea23596fca8831f0 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 01:38:29 +0530 Subject: [PATCH 048/471] added the tests in the CI pipeline of fablo Signed-off-by: Sanket Teli --- .github/workflows/test-on-push.yml | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index f6eda5a0b..f786553fb 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -169,3 +169,55 @@ jobs: path: | e2e-network/docker/test-04-snapshot.sh.logs/* e2e-network/docker/test-04-snapshot.sh.tmpdir/fablo-target/**/* + + test-05-v3: + needs: test-main + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Build Fablo + run: | + shellcheck --version && \ + yamllint -v && \ + npm install && \ + ./fablo-build.sh + + - name: Test version 3 + run: e2e-network/docker/test-05-version3.sh + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-05-version3 + path: | + e2e-network/docker/test-05-version3-snapshot.sh.logs/* + e2e-network/docker/test-05-version3-snapshot.sh.tmpdir/fablo-target/**/* + + test-05-v3-BFT: + needs: test-main + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Build Fablo + run: | + shellcheck --version && \ + yamllint -v && \ + npm install && \ + ./fablo-build.sh + + - name: Test version 3 with BFT + run: e2e-network/docker/test-05-version3.sh + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-05-version3-BFT-snapshot + path: | + e2e-network/docker/test-05-version3-BFT-snapshot.sh.logs/* + e2e-network/docker/test-05-version3-BFT-snapshot.sh.tmpdir/fablo-target/**/* + + From 6884f1721c3b6fb752cdc436c232d97a25c60bec Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 01:47:51 +0530 Subject: [PATCH 049/471] updated testCases.md Signed-off-by: Sanket Teli --- e2e-network/TEST_CASES.md | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 80a71df03..f87022c66 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | -| TLS | no | yes | no | yes | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | -| Consensus | solo | RAFT | solo | RAFT | RAFT | -| Orderer nodes | 1 | 3 | 1 | 1 | 1 | -| Organizations | 1 | 2 | 2 | 1 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | -| Channels | 1 | 2 | 1 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | OR | -| Private data | no | no | yes | yes | no | -| Java chaincode | no | yes | no | no | no | -| Go chaincode | no | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | +| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:|:---------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | +| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | Postgres | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | CouchDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | +| Private data | no | no | yes | yes | no | no | +| Java chaincode | no | yes | no | no | no | no | +| Go chaincode | no | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | channel scripts | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | init, reset | From c278188e1c69766c8194449b263a43c6c369608e Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 13:20:45 +0530 Subject: [PATCH 050/471] fixes in docker-compose Signed-off-by: Sanket Teli --- ...onfig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 4 +--- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 4 +--- ...nfig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 4 +--- ...fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 4 +--- ...nfig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 4 +--- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 -- 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index c5a9def06..daabe2219 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1863,9 +1863,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 3037eeb28..91009e8b4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1827,9 +1827,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index d92769a50..e39714890 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2655,9 +2655,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index bfe6401d5..47ea337c7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3771,9 +3771,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 963c7b2fd..9e0ed2686 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4017,9 +4017,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index e26060fd3..9a3a8b8da 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '2.2' - networks: basic: From 67ea36a866287ca78a4eb0b569c1708d48fd68c2 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 17:44:10 +0530 Subject: [PATCH 051/471] some linting and other fixes Signed-off-by: Sanket Teli --- e2e-network/TEST_CASES.md | 8 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 3434 ++++++++++++++++ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 3459 +++++++++++++++++ e2e/__snapshots__/fabloCommands.test.ts.snap | 2 + ...-config-hlf3-1orgs-1chaincode.json.test.ts | 7 + ...fig-hlf3-bft-1orgs-1chaincode.json.test.ts | 7 + src/setup-docker/index.ts | 4 +- .../scripts/base-functions-v3.sh | 4 +- 8 files changed, 6917 insertions(+), 8 deletions(-) create mode 100644 e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap create mode 100644 e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap create mode 100644 e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts create mode 100644 e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index f87022c66..9e364a136 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -8,8 +8,8 @@ | Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | | Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | | Organizations | 1 | 2 | 2 | 1 | 1 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | CouchDB | +| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | | Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | | Channels | 1 | 2 | 1 | 1 | 1 | 1 | | Node chaincode | yes | yes | yes | yes | yes | yes | @@ -18,5 +18,5 @@ | Private data | no | no | yes | yes | no | no | | Java chaincode | no | yes | no | no | no | no | | Go chaincode | no | no | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | channel scripts | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | init, reset | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap new file mode 100644 index 000000000..29e9fadad --- /dev/null +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -0,0 +1,3434 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V3_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - Host: orderer1.group1.orderer.example.com + Port: 7031 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - Host: orderer2.group1.orderer.example.com + Port: 7032 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - Host: orderer3.group1.orderer.example.com + Port: 7033 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 2 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"FABLO_VERSION=2.0.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=debug + +FABRIC_VERSION=3.0.0-beta +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta + +FABRIC_JAVAENV_VERSION=3.0 +FABRIC_NODEENV_VERSION=3.0 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + cli="" + peer_addresses="" + + peer_certs="" + + if [[ "$1" == *"peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer0.org1.example.com:7041" + + peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" + + fi + if [[ "$1" == *"peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + + peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + + fi + if [ -z "$peer_addresses" ]; then + echo "Unknown peers: $1" + exit 1 + fi + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" + +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + echo "-> Channel query: " + "$@" + + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + # Create directory for chaincode packages to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer0.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer1.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer2.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer3.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + sleep 4 # Wait for Raft cluster to establish consensus + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + echo "Running chaincode in dev mode is supported by Fablo only for V2 channel capabilities" + exit 1 +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + echo "" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \\ + --name $CONTAINER_NAME \\ + -v "$CONFIG_PATH":/fabric-config \\ + -v "$OUTPUT_PATH":/output \\ + hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.pb" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \\ + --channelID "\${CHANNEL_NAME}" \\ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \\ + -o "\${ORDERER_ADMIN_ADDRESS}" \\ + --client-cert "\${ADMIN_TLS_SIGN_CERT}" \\ + --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ + --ca-file "\${TLS_CA_CERT_PATH}" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com + orderer2.group1.orderer.example.com + orderer3.group1.orderer.example.com + peer0.org1.example.com + peer1.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + ca.org1.example.com + " +} + +__getCAPostgresNodes() { + echo " + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap new file mode 100644 index 000000000..8794f0613 --- /dev/null +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -0,0 +1,3459 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V3_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: BFT + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 + ConsenterMapping: + - ID: 1 + Host: orderer0.group1.orderer.example.com + Port: 7030 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - ID: 2 + Host: orderer1.group1.orderer.example.com + Port: 7031 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - ID: 3 + Host: orderer2.group1.orderer.example.com + Port: 7032 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - ID: 4 + Host: orderer3.group1.orderer.example.com + Port: 7033 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 2 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"FABLO_VERSION=2.0.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=debug + +FABRIC_VERSION=3.0.0-beta +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta + +FABRIC_JAVAENV_VERSION=3.0 +FABRIC_NODEENV_VERSION=3.0 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + cli="" + peer_addresses="" + + peer_certs="" + + if [[ "$1" == *"peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer0.org1.example.com:7041" + + peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" + + fi + if [[ "$1" == *"peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + + peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + + fi + if [ -z "$peer_addresses" ]; then + echo "Unknown peers: $1" + exit 1 + fi + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" + +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + echo "-> Channel query: " + "$@" + + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + # Create directory for chaincode packages to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer0.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer1.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer2.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer3.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + echo "Running chaincode in dev mode is supported by Fablo only for V2 channel capabilities" + exit 1 +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + echo "" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \\ + --name $CONTAINER_NAME \\ + -v "$CONFIG_PATH":/fabric-config \\ + -v "$OUTPUT_PATH":/output \\ + hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.pb" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \\ + --channelID "\${CHANNEL_NAME}" \\ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \\ + -o "\${ORDERER_ADMIN_ADDRESS}" \\ + --client-cert "\${ADMIN_TLS_SIGN_CERT}" \\ + --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ + --ca-file "\${TLS_CA_CERT_PATH}" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com + orderer2.group1.orderer.example.com + orderer3.group1.orderer.example.com + peer0.org1.example.com + peer1.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + ca.org1.example.com + " +} + +__getCAPostgresNodes() { + echo " + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 6f3aa8aff..eea3f4ea4 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2470,6 +2471,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", diff --git a/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts b/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts new file mode 100644 index 000000000..e67e776d3 --- /dev/null +++ b/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts @@ -0,0 +1,7 @@ +import performTests from "./performTests"; + +const config = "samples/fablo-config-hlf3-1orgs-1chaincode.json"; + +describe(config, () => { + performTests(config); +}); diff --git a/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts b/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts new file mode 100644 index 000000000..ccd6d764a --- /dev/null +++ b/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts @@ -0,0 +1,7 @@ +import performTests from "./performTests"; + +const config = "samples/fablo-config-hlf3-bft-1orgs-1chaincode.json"; + +describe(config, () => { + performTests(config); +}); diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 18c064739..081ea4890 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -216,12 +216,12 @@ export default class SetupDockerGenerator extends Generator { this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), + this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3 ? "v3" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), ); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3? "v3": "v2"}.sh`), + this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3 ? "v3" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/base-functions.sh"), ); diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index 27f572e33..c3c2e1358 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -78,7 +78,6 @@ createChannelTx() { local CONFIG_PROFILE=$3 local OUTPUT_PATH=$4 local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" - echo CHNANEL_TX_PATH: $CHANNEL_TX_PATH echo "Creating channelTx for $CHANNEL_NAME..." inputLog "CONFIG_PATH: $CONFIG_PATH" @@ -98,7 +97,8 @@ createChannelTx() { -v "$OUTPUT_PATH":/output \ hyperledger/fabric-tools:"${FABRIC_VERSION}" \ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" - + + # shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "Failed to create channel configuration transaction." exit 1 From 78e70e4337fdc58f488881410d8ccf239e37d409 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 17:52:23 +0530 Subject: [PATCH 052/471] updated the workflow file Signed-off-by: Sanket Teli --- .github/workflows/test-on-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index f786553fb..1f908cc7e 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -210,7 +210,7 @@ jobs: ./fablo-build.sh - name: Test version 3 with BFT - run: e2e-network/docker/test-05-version3.sh + run: e2e-network/docker/test-05-version3-BFT.sh - uses: actions/upload-artifact@v4 if: always() From 852037ac9fd944335503fad0fcf13b12f5451db1 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 18:01:47 +0530 Subject: [PATCH 053/471] final fixes Signed-off-by: Sanket Teli --- samples/invalid-fablo-config.json | 67 ------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 samples/invalid-fablo-config.json diff --git a/samples/invalid-fablo-config.json b/samples/invalid-fablo-config.json deleted file mode 100644 index 32abdd3b2..000000000 --- a/samples/invalid-fablo-config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", - "global": { - "fabricVersion": "2.3.3", - "tls": true, - "tools": { - "explorer": true - } - }, - "orgs": [ - { - "organization": { - "name": "some-org1", - "domain": "orderer.example.com", - "mspName": "some-org1" - }, - "orderers": [ - { - "groupName": "group1", - "type": "raft", - "instances": 1 - } - ] - }, - { - "organization": { - "name": "Org1", - "domain": "org1.example.com" - }, - "ca": { - "db": "postgres" - }, - "peer": { - "instances": 1, - "db": "CouchDb" - }, - "tools": { - "fabloRest": true - } - } - ], - "channels": [ - { - "name": "my-channel1", - "orgs": [ - { - "name": "Org1", - "peers": [ - "peer0" - ] - } - ] - } - ], - "chaincodes": [ - { - "name": "chaincode1", - "version": "0.0.1", - "lang": "node", - "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" - } - ], - "hooks": { - "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' \"./fablo-target/fabric-config/configtx.yaml\"" - } -} \ No newline at end of file From 0c3172ee520a3f4e19fb6dbc2f677a5b1ec6f9e4 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:02:02 +0100 Subject: [PATCH 054/471] Update snapshot Signed-off-by: Jakub Dzikowski --- .gitignore | 1 + e2e/__snapshots__/fabloCommands.test.ts.snap | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ef408c5a0..4dd245410 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ fablo-target generators node_modules .idea +samples/invalid-fablo-config.json diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index eea3f4ea4..6f3aa8aff 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,7 +2470,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From 10b4f61ae27a0daed0daf2d7929dbefdd75cb41e Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:25:07 +0100 Subject: [PATCH 055/471] Adjust versions Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/extendConfig.test.ts.snap | 20 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 10 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 620 +----------------- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 + .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- ...ablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- src/extend-config/extendGlobal.ts | 6 +- 7 files changed, 38 insertions(+), 624 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 84c005f6b..e408624e7 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9800,13 +9800,13 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0-beta", + "fabricBaseosVersion": "3.0.0", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0-beta", - "fabricJavaenvVersion": "3.0", - "fabricNodeenvVersion": "3.0", + "fabricCcenvVersion": "3.0.0", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", }, @@ -10757,13 +10757,13 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0-beta", + "fabricBaseosVersion": "3.0.0", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0-beta", - "fabricJavaenvVersion": "3.0", - "fabricNodeenvVersion": "3.0", + "fabricCcenvVersion": "3.0.0", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", }, diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 29e9fadad..43c98acab 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1521,14 +1521,14 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0-beta +FABRIC_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0-beta -FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_CCENV_VERSION=3.0.0 +FABRIC_BASEOS_VERSION=3.0.0 -FABRIC_JAVAENV_VERSION=3.0 -FABRIC_NODEENV_VERSION=3.0 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 8794f0613..b471034a6 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1,5 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/.config/configstore/update-notifier-yo.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "optOut": false, + "lastUpdateCheck": 1733480539656 +}" +`; + exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -19,210 +26,7 @@ Capabilities: V2_5: true ################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - - - Host: peer1.org1.example.com - Port: 7042 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: BFT - Addresses: - - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 - - orderer2.group1.orderer.example.com:7032 - - orderer3.group1.orderer.example.com:7033 - - SmartBFT: - RequestBatchMaxCount: 100 - RequestBatchMaxInterval: 50ms - RequestForwardTimeout: 2s - RequestComplainTimeout: 20s - RequestAutoRemoveTimeout: 3m0s - ViewChangeResendInterval: 5s - ViewChangeTimeout: 20s - LeaderHeartbeatTimeout: 1m0s - CollectTimeout: 1s - RequestBatchMaxBytes: 10485760 - IncomingMessageBufferSize: 200 - RequestPoolSize: 100000 - LeaderHeartbeatCount: 10 - ConsenterMapping: - - ID: 1 - Host: orderer0.group1.orderer.example.com - Port: 7030 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - - ID: 2 - Host: orderer1.group1.orderer.example.com - Port: 7031 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt - - - ID: 3 - Host: orderer2.group1.orderer.example.com - Port: 7032 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt - - - ID: 4 - Host: orderer3.group1.orderer.example.com - Port: 7033 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 10 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 +# CHANNEL " `; @@ -421,18 +225,7 @@ certificateAuthorities: `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - - Hostname: orderer1.group1 - - Hostname: orderer2.group1 - - Hostname: orderer3.group1 - Template: - Count: 0 - Users: - Count: 1 +" " `; @@ -1547,14 +1340,14 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0-beta +FABRIC_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0-beta -FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_CCENV_VERSION=3.0.0 +FABRIC_BASEOS_VERSION=3.0.0 -FABRIC_JAVAENV_VERSION=3.0 -FABRIC_NODEENV_VERSION=3.0 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin @@ -1917,390 +1710,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - orderer1.group1.orderer.example.com: - container_name: orderer1.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7031:7031 - - 8031:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - orderer2.group1.orderer.example.com: - container_name: orderer2.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7032 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7032:7032 - - 8032:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - orderer3.group1.orderer.example.com: - container_name: orderer3.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7033 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7033:7033 - - 8033:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - peer1.org1.example.com: - container_name: peer1.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer1.org1.example.com - - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 - - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" - - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8042:9440 - - 7042:7042 - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic +" " `; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 6f3aa8aff..eea3f4ea4 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2470,6 +2471,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 467c2920e..e5bbf1b2d 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index 8f90718a6..d5548b633 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 9cd63d378..6059db4cc 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -22,13 +22,15 @@ const getVersions = (fabricVersion: string): FabricVersions => { "2.4.1": "2.4.2", }; + const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); + return { fabricVersion, fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", - fabricJavaenvVersion: majorMinor, - fabricNodeenvVersion: fabricNodeenvExceptions[fabricVersion] ?? majorMinor, + fabricJavaenvVersion: below3_0_0(majorMinor), + fabricNodeenvVersion: fabricNodeenvExceptions[fabricVersion] ?? below3_0_0(majorMinor), fabricRecommendedNodeVersion: version(fabricVersion).isGreaterOrEqual("2.4") ? "16" : "12", }; }; From c562f5dcf65bf239a0c2e15c25e8f5a2157b0262 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:34:01 +0100 Subject: [PATCH 056/471] Update snapshots Signed-off-by: Jakub Dzikowski --- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 610 +++++++++++++++++- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 - 2 files changed, 600 insertions(+), 12 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index b471034a6..8bf61889c 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1,12 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/.config/configstore/update-notifier-yo.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"{ - "optOut": false, - "lastUpdateCheck": 1733480539656 -}" -`; - exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -26,7 +19,210 @@ Capabilities: V2_5: true ################################################################################ -# CHANNEL +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: BFT + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 + ConsenterMapping: + - ID: 1 + Host: orderer0.group1.orderer.example.com + Port: 7030 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - ID: 2 + Host: orderer1.group1.orderer.example.com + Port: 7031 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - ID: 3 + Host: orderer2.group1.orderer.example.com + Port: 7032 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - ID: 4 + Host: orderer3.group1.orderer.example.com + Port: 7033 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 " `; @@ -225,7 +421,18 @@ certificateAuthorities: `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -" +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 " `; @@ -1710,7 +1917,390 @@ networkDown() { `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -" +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic " `; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index eea3f4ea4..6f3aa8aff 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,7 +2470,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From 17b119f3611b08f2a8693afffab4a96cdebc9bfb Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:53:11 +0100 Subject: [PATCH 057/471] Add explicit fabricToolsVetsion Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/extendConfig.test.ts.snap | 9 +++++++++ ...lf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 6 +++--- ...fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 6 +++--- ...f2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 8 ++++---- ...onfig-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 10 +++++----- ...f2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 10 +++++----- ...ablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 6 +++--- ...-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 6 +++--- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 ++ src/extend-config/extendGlobal.ts | 1 + src/setup-docker/templates/fabric-docker/.env | 2 +- .../templates/fabric-docker/docker-compose.yaml | 2 +- src/types/FabloConfigExtended.ts | 1 + 13 files changed, 41 insertions(+), 28 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index e408624e7..9aeff5dc8 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -594,6 +594,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.9", "fabricVersion": "2.5.9", "monitoring": { "loglevel": "info", @@ -1419,6 +1420,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.7", "fabricVersion": "2.4.7", "monitoring": { "loglevel": "info", @@ -2219,6 +2221,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.3", "fabricVersion": "2.3.3", "monitoring": { "loglevel": "info", @@ -3588,6 +3591,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.7", "fabricVersion": "2.4.7", "monitoring": { "loglevel": "info", @@ -5846,6 +5850,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.3", "fabricVersion": "2.4.3", "monitoring": { "loglevel": "debug", @@ -8435,6 +8440,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.2", "fabricVersion": "2.3.2", "monitoring": { "loglevel": "info", @@ -9806,6 +9812,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", @@ -10763,6 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", @@ -11629,6 +11637,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.3", "fabricVersion": "2.3.3", "monitoring": { "loglevel": "info", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index daabe2219..eace9e6b3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1539,11 +1539,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.3.3 +FABRIC_TOOLS_VERSION=2.3.3 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 FABRIC_BASEOS_VERSION=2.3.3 - FABRIC_JAVAENV_VERSION=2.3 FABRIC_NODEENV_VERSION=2.3 RECOMMENDED_NODE_VERSION=12 @@ -1890,7 +1890,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2002,7 +2002,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 91009e8b4..2e511d2b0 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1450,11 +1450,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.5.9 +FABRIC_TOOLS_VERSION=2.5.9 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 FABRIC_BASEOS_VERSION=2.5.9 - FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1853,7 +1853,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -1924,7 +1924,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index e39714890..4aedb4494 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2111,11 +2111,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.4.7 +FABRIC_TOOLS_VERSION=2.4.7 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 FABRIC_BASEOS_VERSION=2.4.7 - FABRIC_JAVAENV_VERSION=2.4 FABRIC_NODEENV_VERSION=2.4 RECOMMENDED_NODE_VERSION=16 @@ -2681,7 +2681,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2755,7 +2755,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2892,7 +2892,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 47ea337c7..9835c648c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3034,11 +3034,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=2.4.3 +FABRIC_TOOLS_VERSION=2.4.3 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 FABRIC_BASEOS_VERSION=2.4.3 - FABRIC_JAVAENV_VERSION=2.4 FABRIC_NODEENV_VERSION=2.4 RECOMMENDED_NODE_VERSION=16 @@ -3798,7 +3798,7 @@ services: cli.orderer1.com: container_name: cli.orderer1.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -3964,7 +3964,7 @@ services: cli.orderer2.com: container_name: cli.orderer2.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4058,7 +4058,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4237,7 +4237,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 9e0ed2686..d2de3b306 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3329,11 +3329,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.3.2 +FABRIC_TOOLS_VERSION=2.3.2 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 FABRIC_BASEOS_VERSION=2.3.2 - FABRIC_JAVAENV_VERSION=2.3 FABRIC_NODEENV_VERSION=2.3 RECOMMENDED_NODE_VERSION=12 @@ -4044,7 +4044,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4177,7 +4177,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4406,7 +4406,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4635,7 +4635,7 @@ services: cli.org3.example.com: container_name: cli.org3.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 43c98acab..2e4a2b316 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1522,11 +1522,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 +FABRIC_TOOLS_VERSION=2.5 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 FABRIC_BASEOS_VERSION=3.0.0 - FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1919,7 +1919,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2145,7 +2145,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 8bf61889c..8783caddf 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1548,11 +1548,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 +FABRIC_TOOLS_VERSION=2.5 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 FABRIC_BASEOS_VERSION=3.0.0 - FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1944,7 +1944,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2170,7 +2170,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 6f3aa8aff..c769e0969 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -11,6 +11,7 @@ Validation warnings count: 0 "monitoring": { "loglevel": "debug" }, + "fabricToolsVersion": "2.4.3", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.4.3", "fabricBaseosVersion": "2.4.3", @@ -2476,6 +2477,7 @@ Validation warnings count: 0 "tls": false, "engine": "docker", "peerDevMode": false, + "fabricToolsVersion": "2.5.9", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.5.9", "fabricBaseosVersion": "2.5.9", diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 6059db4cc..62e51bc25 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -26,6 +26,7 @@ const getVersions = (fabricVersion: string): FabricVersions => { return { fabricVersion, + fabricToolsVersion: below3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index bfdc840c8..9cdbdae4f 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -13,11 +13,11 @@ COMPOSE_PROJECT_NAME=<%= composeNetworkName %> LOGGING_LEVEL=<%= global.monitoring.loglevel %> FABRIC_VERSION=<%= global.fabricVersion %> +FABRIC_TOOLS_VERSION=<%= global.fabricToolsVersion %> FABRIC_CA_VERSION=<%= global.fabricCaVersion %> FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %> - FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %> FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %> RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9a3a8b8da..9b6232f6a 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -56,7 +56,7 @@ services: <%= org.cli.address %>: container_name: <%= org.cli.address %> - image: hyperledger/fabric-tools:${FABRIC_VERSION} + image: hyperledger/fabric-tools:${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 3a20c75d9..65de5bc14 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -1,5 +1,6 @@ export interface FabricVersions { fabricVersion: string; + fabricToolsVersion: string; fabricCaVersion: string; fabricCcenvVersion: string; fabricBaseosVersion: string; From cc2b054355dc7025b8f9eff8df3acf2711f24228 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 16:20:39 +0100 Subject: [PATCH 058/471] Update Docker commands to use FABRIC_TOOLS_VERSION instead of FABRIC_VERSION in multiple scripts and snapshot files Signed-off-by: Jakub Dzikowski --- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 8 ++++---- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 8 ++++---- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 8 ++++---- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 8 ++++---- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 8 ++++---- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 8 ++++---- ...blo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 8 ++++---- .../templates/fabric-docker/scripts/base-functions-v2.sh | 8 ++++---- .../templates/fabric-docker/scripts/base-functions-v3.sh | 8 ++++---- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index eace9e6b3..015b868e3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2196,7 +2196,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2232,7 +2232,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2265,7 +2265,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2302,7 +2302,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 2e511d2b0..861c998ee 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2064,7 +2064,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2100,7 +2100,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2133,7 +2133,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2170,7 +2170,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 4aedb4494..ee1ecb951 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2991,7 +2991,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -3027,7 +3027,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -3060,7 +3060,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -3097,7 +3097,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 9835c648c..b21da4d61 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4400,7 +4400,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -4436,7 +4436,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4469,7 +4469,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4506,7 +4506,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index d2de3b306..eea88db84 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4912,7 +4912,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -4948,7 +4948,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4981,7 +4981,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -5018,7 +5018,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 2e4a2b316..ac949748f 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -2304,7 +2304,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2340,7 +2340,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2377,7 +2377,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2416,7 +2416,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 8783caddf..e30772692 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -2329,7 +2329,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2365,7 +2365,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2402,7 +2402,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2441,7 +2441,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 55f69fcfa..fc2f02f67 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -91,7 +91,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -128,7 +128,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index c3c2e1358..da91a34be 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -95,7 +95,7 @@ createChannelTx() { --name $CONTAINER_NAME \ -v "$CONFIG_PATH":/fabric-config \ -v "$OUTPUT_PATH":/output \ - hyperledger/fabric-tools:"${FABRIC_VERSION}" \ + hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -136,7 +136,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME From 4d46dc42525a89f9f0ff1772973556f13482bbb7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 16:47:30 +0100 Subject: [PATCH 059/471] Update fabricToolsVersion to 3.0.0-beta in configuration snapshots and extendGlobal logic Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/extendConfig.test.ts.snap | 4 ++-- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- .../fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 ++ src/extend-config/extendGlobal.ts | 4 +++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 9aeff5dc8..824efa1cd 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9812,7 +9812,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "2.5", + "fabricToolsVersion": "3.0.0-beta", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", @@ -10770,7 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "2.5", + "fabricToolsVersion": "3.0.0-beta", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index ac949748f..d821017c6 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1522,7 +1522,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 -FABRIC_TOOLS_VERSION=2.5 +FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index e30772692..546232b25 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1548,7 +1548,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 -FABRIC_TOOLS_VERSION=2.5 +FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index c769e0969..280c9d90d 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,6 +2472,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 62e51bc25..0bd8abda3 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -24,9 +24,11 @@ const getVersions = (fabricVersion: string): FabricVersions => { const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); + const beta3_0_0 = (v: string) => (v.startsWith("3.0.") ? "3.0.0-beta" : v); + return { fabricVersion, - fabricToolsVersion: below3_0_0(fabricVersion), + fabricToolsVersion: beta3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", From 79925894919959fc370916bcd3464c7757480611 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 16:56:54 +0100 Subject: [PATCH 060/471] Update snapshots Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 -- 1 file changed, 2 deletions(-) diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 280c9d90d..c769e0969 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2472,7 +2471,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From 0548639ffbdba402bc1fcda111f299a9ffd3a45a Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 11:01:35 +0100 Subject: [PATCH 061/471] Validation changes to make explicit Fablo supports Fabric up to 3.0.0-beta Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/extendConfig.test.ts.snap | 12 ++--- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 45 +++++++++++++++++-- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 6 +-- .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- ...ablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- src/repositoryUtils.test.ts | 4 ++ src/validate/index.ts | 21 +++++++++ 7 files changed, 78 insertions(+), 14 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 824efa1cd..0473ec547 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9806,14 +9806,14 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0", + "fabricBaseosVersion": "3.0.0-beta", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0", + "fabricCcenvVersion": "3.0.0-beta", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", "fabricToolsVersion": "3.0.0-beta", - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "monitoring": { "loglevel": "debug", }, @@ -10764,14 +10764,14 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0", + "fabricBaseosVersion": "3.0.0-beta", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0", + "fabricCcenvVersion": "3.0.0-beta", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", "fabricToolsVersion": "3.0.0-beta", - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "monitoring": { "loglevel": "debug", }, diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index d821017c6..4391df33f 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1,5 +1,43 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"0 verbose cli /usr/local/bin/node /usr/local/bin/npm +1 info using npm@9.5.1 +2 info using node@v18.16.0 +3 timing npm:load:whichnode Completed in 6ms +4 timing config:load:defaults Completed in 1ms +5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms +6 timing config:load:builtin Completed in 1ms +7 timing config:load:cli Completed in 2ms +8 timing config:load:env Completed in 0ms +9 timing config:load:project Completed in 7ms +10 timing config:load:file:/network/workspace/.npmrc Completed in 2ms +11 timing config:load:user Completed in 2ms +12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms +13 timing config:load:global Completed in 0ms +14 timing config:load:setEnvs Completed in 0ms +15 timing config:load Completed in 15ms +16 timing npm:load:configload Completed in 15ms +17 timing npm:load:mkdirpcache Completed in 8ms +18 timing npm:load:mkdirplogs Completed in 12ms +19 verbose title npm root +20 verbose argv "root" "--global" +21 timing npm:load:setTitle Completed in 2ms +22 timing config:load:flatten Completed in 2ms +23 timing npm:load:display Completed in 3ms +24 verbose logfile logs-max:10 dir:/network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z- +25 verbose logfile /network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log +26 timing npm:load:logFile Completed in 68ms +27 timing npm:load:timers Completed in 0ms +28 timing npm:load:configScope Completed in 0ms +29 timing npm:load Completed in 118ms +30 timing command:root Completed in 5ms +31 verbose exit 0 +32 timing npm Completed in 140ms +33 info ok +" +`; + exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -1521,12 +1559,12 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0 +FABRIC_VERSION=3.0.0-beta FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0 -FABRIC_BASEOS_VERSION=3.0.0 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -3406,6 +3444,7 @@ echo "Executing post-generate hook" exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 546232b25..ca807e361 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1547,12 +1547,12 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0 +FABRIC_VERSION=3.0.0-beta FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0 -FABRIC_BASEOS_VERSION=3.0.0 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index e5bbf1b2d..467c2920e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index d5548b633..8f90718a6 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index b50b6455f..bbd7ba2f8 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -19,5 +19,9 @@ describe("repositoryUtils", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); expect(version("1.4.0").isGreaterOrEqual("1.3.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("2.1.0")).toBe(false); + expect(version("3.0.0").isGreaterOrEqual("3.0.0-beta")).toBe(true); + expect(version("3.0.0-beta").isGreaterOrEqual("3.0.0")).toBe(true); + expect(version("3.0.0").isGreaterOrEqual("3.0.0")).toBe(true); + expect(version("3.0.0").isGreaterOrEqual("3.0.1")).toBe(false); }); }); diff --git a/src/validate/index.ts b/src/validate/index.ts index 3d8a3b883..fd7044f53 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -90,6 +90,7 @@ class ValidateGenerator extends Generator { this._validateIfConfigFileExists(this.options.fabloConfig); const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); + this._validateFabricVersion(networkConfig.global); this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); @@ -122,6 +123,26 @@ class ValidateGenerator extends Generator { this._verifyFabricVersion(networkConfig.global); } + private _validateFabricVersion(global: GlobalJson) { + // 1. we support fabric up to 3.0.0-beta + if (version(global.fabricVersion).isGreaterOrEqual("3.0.0") && global.fabricVersion !== "3.0.0-beta") { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric up to 3.0.0-beta.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + + // 2. we support Fabric starting from 2.0.0 + if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric starting from 2.0.0.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } + async shortSummary() { console.log(`Validation errors count: ${this.errors.count()}`); console.log(`Validation warnings count: ${this.warnings.count()}`); From 52bbacf22b4367ecbbf63476f8a402ae2d1b08d9 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 11:01:45 +0100 Subject: [PATCH 062/471] Update CHANGELOG Signed-off-by: Jakub Dzikowski --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b56ebbf..5c00d166a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.1.0 + +### Features +* Support Fabric 3.0.0-beta, along with BFT consensus + [#501](https://github.com/hyperledger-labs/fablo/pull/501) + ## 2.0.0 ### Breaking changes From 8daded373752ed2baed579da07dd327188202c7b Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 11:16:56 +0100 Subject: [PATCH 063/471] Update snapshots Signed-off-by: Jakub Dzikowski --- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 4391df33f..800134ea0 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1,43 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"0 verbose cli /usr/local/bin/node /usr/local/bin/npm -1 info using npm@9.5.1 -2 info using node@v18.16.0 -3 timing npm:load:whichnode Completed in 6ms -4 timing config:load:defaults Completed in 1ms -5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms -6 timing config:load:builtin Completed in 1ms -7 timing config:load:cli Completed in 2ms -8 timing config:load:env Completed in 0ms -9 timing config:load:project Completed in 7ms -10 timing config:load:file:/network/workspace/.npmrc Completed in 2ms -11 timing config:load:user Completed in 2ms -12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms -13 timing config:load:global Completed in 0ms -14 timing config:load:setEnvs Completed in 0ms -15 timing config:load Completed in 15ms -16 timing npm:load:configload Completed in 15ms -17 timing npm:load:mkdirpcache Completed in 8ms -18 timing npm:load:mkdirplogs Completed in 12ms -19 verbose title npm root -20 verbose argv "root" "--global" -21 timing npm:load:setTitle Completed in 2ms -22 timing config:load:flatten Completed in 2ms -23 timing npm:load:display Completed in 3ms -24 verbose logfile logs-max:10 dir:/network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z- -25 verbose logfile /network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log -26 timing npm:load:logFile Completed in 68ms -27 timing npm:load:timers Completed in 0ms -28 timing npm:load:configScope Completed in 0ms -29 timing npm:load Completed in 118ms -30 timing command:root Completed in 5ms -31 verbose exit 0 -32 timing npm Completed in 140ms -33 info ok -" -`; - exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -3444,7 +3406,6 @@ echo "Executing post-generate hook" exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ - "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", From 8e9c968fae52dcb9a62460344d77380c96d7f4c3 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 12:42:46 +0100 Subject: [PATCH 064/471] Create directory to avoid permission errors Signed-off-by: Jakub Dzikowski --- ...org-1chaincode-raft-explorer.json.test.ts.snap | 3 ++- ...-config-hlf2-1org-1chaincode.json.test.ts.snap | 3 ++- ...rgs-2chaincodes-private-data.yaml.test.ts.snap | 3 ++- ...-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 3 ++- ...rgs-1chaincode-raft-explorer.json.test.ts.snap | 3 ++- ...config-hlf3-1orgs-1chaincode.json.test.ts.snap | 15 +++++++-------- ...ig-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 15 +++++++-------- .../templates/fabric-docker/commands-generated.sh | 3 ++- .../fabric-docker/scripts/cli/channel_fns-v3.sh | 13 +++++-------- 9 files changed, 31 insertions(+), 30 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 015b868e3..21b4d6417 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1700,8 +1700,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 861c998ee..4e9b88f95 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,8 +1651,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index ee1ecb951..f6cf5a4f6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2366,8 +2366,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index b21da4d61..48ec32465 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3476,8 +3476,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group2" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group2Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index eea88db84..7069bba2e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3814,8 +3814,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 800134ea0..014e80feb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1730,8 +1730,9 @@ generateArtifacts() { printItalics "Generating crypto material for Org1" "U1F512" certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -3186,7 +3187,7 @@ createChannelAndJoin() { cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } createChannelAndJoinTls() { @@ -3207,7 +3208,7 @@ createChannelAndJoinTls() { echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" if [ ! -d "$DIR_NAME" ]; then - mkdir "$DIR_NAME" + mkdir -p "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" fi @@ -3219,16 +3220,15 @@ createChannelAndJoinTls() { --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ --ca-file "\${TLS_CA_CERT_PATH}" + cd .. rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3244,12 +3244,11 @@ fetchChannelAndJoin() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" peer channel join -b "\${CHANNEL_NAME}"_newest.block - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3278,7 +3277,7 @@ fetchChannelAndJoinTls() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } " `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index ca807e361..1509993f8 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1756,8 +1756,9 @@ generateArtifacts() { printItalics "Generating crypto material for Org1" "U1F512" certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -3211,7 +3212,7 @@ createChannelAndJoin() { cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } createChannelAndJoinTls() { @@ -3232,7 +3233,7 @@ createChannelAndJoinTls() { echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" if [ ! -d "$DIR_NAME" ]; then - mkdir "$DIR_NAME" + mkdir -p "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" fi @@ -3244,16 +3245,15 @@ createChannelAndJoinTls() { --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ --ca-file "\${TLS_CA_CERT_PATH}" + cd .. rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3269,12 +3269,11 @@ fetchChannelAndJoin() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" peer channel join -b "\${CHANNEL_NAME}"_newest.block - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3303,7 +3302,7 @@ fetchChannelAndJoinTls() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } " `; diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index d9c4b023f..b22588f21 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -20,8 +20,9 @@ generateArtifacts() { <% } %> <%_ }) _%> - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 1b51468aa..247e26e10 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -21,11 +21,10 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } createChannelAndJoinTls() { @@ -46,7 +45,7 @@ createChannelAndJoinTls() { echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" if [ ! -d "$DIR_NAME" ]; then - mkdir "$DIR_NAME" + mkdir -p "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" fi @@ -58,16 +57,15 @@ createChannelAndJoinTls() { --client-key "${ADMIN_TLS_PRIVATE_KEY}" \ --ca-file "${TLS_CA_CERT_PATH}" + cd .. rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -83,12 +81,11 @@ fetchChannelAndJoin() { peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" peer channel join -b "${CHANNEL_NAME}"_newest.block - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -117,5 +114,5 @@ fetchChannelAndJoinTls() { peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } From 667fb185bcce9b4c4cca400586ae59e228d4ec45 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Wed, 8 Jan 2025 12:11:44 +0100 Subject: [PATCH 065/471] Set version 2.1.0 Signed-off-by: Jakub Dzikowski --- README.md | 8 ++++---- bump-version.sh | 4 ++-- docs/sample.json | 2 +- docs/schema.json | 2 +- ...ablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap | 2 +- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- ...blo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 +++--- e2e/__snapshots__/schema.test.ts.snap | 2 +- fablo.sh | 2 +- package-lock.json | 4 ++-- package.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-k8s.json | 2 +- .../fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode.json | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml | 2 +- samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml | 2 +- .../fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- samples/fablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- 25 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 95ebe9799..af23e7b5e 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ You may keep the script in the root directory of your project or install it glob To install it globally: ```bash -sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo +sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo ``` To get a copy of Fablo for a single project, execute in the project root: ```bash -curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o ./fablo && chmod +x ./fablo +curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o ./fablo && chmod +x ./fablo ``` ## Getting started @@ -344,7 +344,7 @@ The basic structure of Fablo config file is as follows: ```json { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { ... }, "orgs": [ ... ], "channels": [ ... ], @@ -507,7 +507,7 @@ Genrated Hooks are saved in `fablo-target/hooks`. ```yaml --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json global: fabricVersion: 2.4.2 tls: false diff --git a/bump-version.sh b/bump-version.sh index e185c675b..8d3ca5e5f 100755 --- a/bump-version.sh +++ b/bump-version.sh @@ -7,9 +7,9 @@ include_readme=true ver_arg="${1:-unstable}" if [ "$ver_arg" = "patch" ] || [ "$ver_arg" = "minor" ] || [ "$ver_arg" = "major" ]; then - new_version=$(semver "$old_version" -i "$ver_arg") + new_version=$(semver next "$ver_arg" "$old_version") elif [ "$ver_arg" = "unstable" ]; then - new_version=$(semver "$old_version" -i prerelease --preid unstable) + new_version="$(semver next patch "$old_version")-unstable" include_readme=false elif [ "$ver_arg" = "set" ]; then new_version="$2" diff --git a/docs/sample.json b/docs/sample.json index 360bec3d8..98635be5a 100644 --- a/docs/sample.json +++ b/docs/sample.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": false, diff --git a/docs/schema.json b/docs/schema.json index 2f411465c..5959b4eae 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -12,7 +12,7 @@ ], "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json" + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json" }, "global": { "$id": "#/properties/global", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 94939945c..d0652318e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -86,7 +86,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper REPOSITORY="https://kfsoftware.github.io/hlf-helm-charts" STORAGE_CLASS=$(kubectl describe sc | grep Name | tr -s ' ' | cut -d ':' -f 2 | cut -d ' ' -f 2) -FABLO_VERSION=2.0.0 +FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_CONFIG= ORDERER_IMAGE=hyperledger/fabric-orderer diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 21b4d6417..1d6eadd1a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1524,7 +1524,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 4e9b88f95..27cf0a253 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1435,7 +1435,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index f6cf5a4f6..f241869fa 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2096,7 +2096,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 48ec32465..3e152f3c7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3019,7 +3019,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 7069bba2e..978b75863 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3314,7 +3314,7 @@ fi `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 014e80feb..383677e96 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1507,7 +1507,7 @@ fi `; exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 1509993f8..40a05191a 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1533,7 +1533,7 @@ fi `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index c769e0969..74c92c453 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2965,7 +2965,7 @@ Validation warnings count: 0 exports[`init should init simple fablo config 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3019,7 +3019,7 @@ exports[`init should init simple fablo config 1`] = ` exports[`init should init simple fablo config with node chaincode 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3081,7 +3081,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` exports[`init should init simple fablo config with node chaincode and rest api 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 1613693ae..c93059f0d 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -7,7 +7,7 @@ exports[`schema should match snapshot 1`] = ` "default": {}, "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", }, "chaincodes": { "$id": "#/properties/chaincodes", diff --git a/fablo.sh b/fablo.sh index ac6dbaeaa..92b2e0eae 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,7 +2,7 @@ set -e -FABLO_VERSION=1.2.1-unstable.0 +FABLO_VERSION=2.1.0 FABLO_IMAGE_NAME="ghcr.io/fablo-io/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" diff --git a/package-lock.json b/package-lock.json index 8ec5e9e25..ec4e79c73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generator-fablo", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "generator-fablo", - "version": "2.0.0", + "version": "2.1.0", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index b3f81f51d..07e644d5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-fablo", - "version": "2.0.0", + "version": "2.1.0", "description": "Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.", "author": "Piotr Hejwowski , Jakub Dzikowski ", "repository": { diff --git a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json index 62ef917d6..629ba983e 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.4.7", "tls": false, diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 176cb5a0f..fd7196f06 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.3.3", "tls": true, diff --git a/samples/fablo-config-hlf2-1org-1chaincode.json b/samples/fablo-config-hlf2-1org-1chaincode.json index 4053ad5a0..fb890fff2 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml index c71fef021..4a31f8f39 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json global: fabricVersion: 2.4.7 tls: false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml index 2fdb0d9cb..c3a944074 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json global: fabricVersion: 2.4.3 tls: true diff --git a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json index e1686dbfe..91e0e3f6e 100644 --- a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": true, diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 467c2920e..b7a78431c 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index 8f90718a6..a35c76f07 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, From 4fcd869780c06ef99ca963d924655b9bab6c769a Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Wed, 8 Jan 2025 12:12:08 +0100 Subject: [PATCH 066/471] Add VSC config to gitignore Signed-off-by: Jakub Dzikowski --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4dd245410..25d70bd35 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ fablo-target generators node_modules .idea +.vscode samples/invalid-fablo-config.json From 8fc03e99b08cdd70daab53cfd4a833c4274fd8fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:31:45 +0000 Subject: [PATCH 067/471] Bump cross-spawn from 7.0.3 to 7.0.6 Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6. - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec4e79c73..84363f847 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4145,9 +4145,9 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -17621,9 +17621,9 @@ "dev": true }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", From 6928bf7668d61153963698b272e9e51da10a932b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:53:12 +0000 Subject: [PATCH 068/471] Bump ejs and ejs-lint Bumps [ejs](https://github.com/mde/ejs) to 3.1.10 and updates ancestor dependency [ejs-lint](https://github.com/ryanzim/ejs-lint). These dependencies need to be updated together. Updates `ejs` from 3.1.7 to 3.1.10 - [Release notes](https://github.com/mde/ejs/releases) - [Commits](https://github.com/mde/ejs/compare/v3.1.7...v3.1.10) Updates `ejs-lint` from 1.2.2 to 2.0.1 - [Release notes](https://github.com/ryanzim/ejs-lint/releases) - [Commits](https://github.com/ryanzim/ejs-lint/compare/v1.2.2...2.0.1) --- updated-dependencies: - dependency-name: ejs dependency-type: indirect - dependency-name: ejs-lint dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package-lock.json | 212 +++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 183 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84363f847..4c7923383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "copyfiles": "2.4.1", - "ejs-lint": "^1.2.0", + "ejs-lint": "^2.0.1", "eslint": "^7.24.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.2.0", @@ -4676,37 +4676,127 @@ "dev": true }, "node_modules/ejs-lint": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-1.2.2.tgz", - "integrity": "sha512-ESR/MePvJJJfkK3EUAYlPKe2JM2nRDc4uFkGgbB5Prr06nluN7JozNVFL3Ze7LV7xNY7JPWEi5H3i4hOl6mxXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.1.tgz", + "integrity": "sha512-GrH+UuYaOlhS/cnCJEY5EANnFvWe6zyf0h6uOAKG2/EiG2Ch9S8vnX3CwAMP9Q1xlCagPNzwRDJG8MVCV4IJLg==", "dev": true, "dependencies": { - "chalk": "^4.0.0", - "ejs": "3.1.7", + "chalk": "^5.0.0", + "ejs": "3.1.10", "ejs-include-regex": "^1.0.0", - "globby": "^11.0.0", + "globby": "^13.0.0", "read-input": "^0.3.1", - "slash": "^3.0.0", + "slash": "^5.0.0", "syntax-error": "^1.1.6", - "yargs": "^16.0.0" + "yargs": "^17.0.0" }, "bin": { "ejslint": "cli.js" } }, - "node_modules/ejs-lint/node_modules/ejs": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", + "node_modules/ejs-lint/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ejs-lint/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { - "jake": "^10.8.5" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" }, - "bin": { - "ejs": "bin/cli.js" + "engines": { + "node": ">=12" + } + }, + "node_modules/ejs-lint/node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/globby/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ejs-lint/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ejs-lint/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" } }, "node_modules/electron-to-chromium": { @@ -17996,29 +18086,91 @@ "dev": true }, "ejs-lint": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-1.2.2.tgz", - "integrity": "sha512-ESR/MePvJJJfkK3EUAYlPKe2JM2nRDc4uFkGgbB5Prr06nluN7JozNVFL3Ze7LV7xNY7JPWEi5H3i4hOl6mxXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.1.tgz", + "integrity": "sha512-GrH+UuYaOlhS/cnCJEY5EANnFvWe6zyf0h6uOAKG2/EiG2Ch9S8vnX3CwAMP9Q1xlCagPNzwRDJG8MVCV4IJLg==", "dev": true, "requires": { - "chalk": "^4.0.0", - "ejs": "3.1.7", + "chalk": "^5.0.0", + "ejs": "3.1.10", "ejs-include-regex": "^1.0.0", - "globby": "^11.0.0", + "globby": "^13.0.0", "read-input": "^0.3.1", - "slash": "^3.0.0", + "slash": "^5.0.0", "syntax-error": "^1.1.6", - "yargs": "^16.0.0" + "yargs": "^17.0.0" }, "dependencies": { - "ejs": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", "dev": true, "requires": { - "jake": "^10.8.5" + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "dependencies": { + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + } } + }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, + "slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true } } }, diff --git a/package.json b/package.json index 07e644d5a..4a88d1ebf 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "copyfiles": "2.4.1", - "ejs-lint": "^1.2.0", + "ejs-lint": "^2.0.1", "eslint": "^7.24.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.2.0", From 5ef0c24a3273faa1c42194001ce1a2dccf6acb26 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Wed, 8 Jan 2025 12:13:19 +0100 Subject: [PATCH 069/471] NPM audit fix Signed-off-by: Jakub Dzikowski --- package-lock.json | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c7923383..42ab6c18c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8845,9 +8845,9 @@ "devOptional": true }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -8855,6 +8855,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -9947,10 +9948,11 @@ } }, "node_modules/path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", + "integrity": "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==", "dev": true, + "license": "MIT", "dependencies": { "isarray": "0.0.1" } @@ -21266,9 +21268,9 @@ "devOptional": true }, "nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true }, "natural-compare": { @@ -22110,9 +22112,9 @@ } }, "path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", + "integrity": "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==", "dev": true, "requires": { "isarray": "0.0.1" From 3c767764d7aacba9f4d06ca715832d6c303a7526 Mon Sep 17 00:00:00 2001 From: SRshohan Date: Fri, 7 Feb 2025 02:36:57 -0500 Subject: [PATCH 070/471] Added Signed-off-by: SRshohan --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af23e7b5e..63b6a659d 100644 --- a/README.md +++ b/README.md @@ -213,12 +213,12 @@ Chaincode directory is specified in Fablo config file. Invokes chaincode with specified parameters. ``` -fablo chaincode invoke [transient] +fablo chaincode invoke [transient] ``` Sample command: ``` -fablo chaincode invoke "my-channel1" "chaincode1" "peer0.org1.example.com" '{"Args":["KVContract:put", "name", "Willy Wonka"]}' +fablo chaincode invoke "peer0.org1.example.com" "my-channel1" "chaincode1" '{"Args":["KVContract:put", "name", "Willy Wonka"]}' ``` ### chaincodes list From 4bf0214b6cab9741da4b60b97f7e2af6de20d457 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 14 Feb 2025 11:32:00 +0100 Subject: [PATCH 071/471] Chore: Update MAINTAINERS.md Signed-off-by: Jakub Dzikowski --- MAINTAINERS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index ad4b37b98..62572e6f1 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -3,6 +3,6 @@ ### Active Maintainers | name | Github | |-------------------|-----------| -| Piotr Hejwowski | [@hejwo](https://github.com/hejwo) | -| Jakub Dzikowski | [@dzikowski](https://github.com/dzikowski) | -| Grzegorz Hejduk | [@gzhk](https://github.com/gzhk) | +| Piotr Hejwowski | [@hejwo](https://github.com/hejwo) | +| Jakub Dzikowski | [@dzikowski](https://github.com/dzikowski) | +| Great Umegbewe | [@umegbewe](https://github.com/umegbewe) | From 45f572e82438c7f0001308a2b7a3058e5e588240 Mon Sep 17 00:00:00 2001 From: Great Date: Fri, 21 Mar 2025 12:13:47 +0100 Subject: [PATCH 072/471] Merge pull request #513 from umegbewe/feat/support-fabric-v3-completion feat: fabric v3 support completion --- CHANGELOG.md | 6 +++ e2e/__snapshots__/extendConfig.test.ts.snap | 10 ++--- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 38 ++++++++++--------- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 31 ++++++++------- fablo-build.sh | 2 +- .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- src/extend-config/extendGlobal.ts | 4 +- .../templates/fabric-config/configtx.yaml | 6 +++ .../fabric-docker/docker-compose.yaml | 4 ++ .../scripts/base-functions-v3.sh | 8 ++-- src/validate/index.ts | 37 +++++++++--------- 11 files changed, 86 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c00d166a..c5d0bdbf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.2.0 + +### Features +* Full support for Fabric 3.0.0 and drop solo consensus + [#513](https://github.com/hyperledger-labs/fablo/pull/513) + ## 2.1.0 ### Features diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 0473ec547..ee52ee4fb 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9806,14 +9806,14 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0-beta", + "fabricBaseosVersion": "3.0.0", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0-beta", + "fabricCcenvVersion": "3.0.0", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "3.0.0-beta", - "fabricVersion": "3.0.0-beta", + "fabricToolsVersion": "3.0.0", + "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", }, @@ -10770,7 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "3.0.0-beta", + "fabricToolsVersion": "3.0.0", "fabricVersion": "3.0.0-beta", "monitoring": { "loglevel": "debug", diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 383677e96..c3eaa266f 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -43,7 +43,11 @@ Organizations: Name: OrdererMSP ID: OrdererMSP MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -64,7 +68,11 @@ Organizations: Name: Org1MSP ID: Org1MSP MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -115,11 +123,7 @@ Application: &ApplicationDefaults ################################################################################ Orderer: &Group1Defaults OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 - - orderer2.group1.orderer.example.com:7032 - - orderer3.group1.orderer.example.com:7033 + EtcdRaft: Consenters: - Host: orderer0.group1.orderer.example.com @@ -1521,12 +1525,12 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0-beta -FABRIC_TOOLS_VERSION=3.0.0-beta +FABRIC_VERSION=3.0.0 +FABRIC_TOOLS_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0-beta -FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_CCENV_VERSION=3.0.0 +FABRIC_BASEOS_VERSION=3.0.0 FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1920,7 +1924,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2146,7 +2150,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2305,7 +2309,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2341,7 +2345,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2378,7 +2382,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ + ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2417,7 +2421,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 40a05191a..1a117eabe 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -43,7 +43,11 @@ Organizations: Name: OrdererMSP ID: OrdererMSP MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -64,7 +68,11 @@ Organizations: Name: Org1MSP ID: Org1MSP MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -115,11 +123,6 @@ Application: &ApplicationDefaults ################################################################################ Orderer: &Group1Defaults OrdererType: BFT - Addresses: - - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 - - orderer2.group1.orderer.example.com:7032 - - orderer3.group1.orderer.example.com:7033 SmartBFT: RequestBatchMaxCount: 100 @@ -1548,7 +1551,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0-beta -FABRIC_TOOLS_VERSION=3.0.0-beta +FABRIC_TOOLS_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0-beta @@ -1945,7 +1948,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2171,7 +2174,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2330,7 +2333,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2366,7 +2369,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2403,7 +2406,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ + ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2442,7 +2445,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/fablo-build.sh b/fablo-build.sh index be08ec90d..a548f26b7 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -46,4 +46,4 @@ else --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" docker tag "$IMAGE_BASE_NAME" "ghcr.io/fablo-io/fablo:$FABLO_VERSION" -fi +fi \ No newline at end of file diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index b7a78431c..e6715804f 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 0bd8abda3..7496bd175 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -24,11 +24,11 @@ const getVersions = (fabricVersion: string): FabricVersions => { const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); - const beta3_0_0 = (v: string) => (v.startsWith("3.0.") ? "3.0.0-beta" : v); + const is_or_above3_0_0 = (v: string) => (v.startsWith("3.") ? "3.0.0" : v); return { fabricVersion, - fabricToolsVersion: beta3_0_0(fabricVersion), + fabricToolsVersion: is_or_above3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", diff --git a/src/setup-docker/templates/fabric-config/configtx.yaml b/src/setup-docker/templates/fabric-config/configtx.yaml index 95c5d4d0f..5b0c3ec7f 100755 --- a/src/setup-docker/templates/fabric-config/configtx.yaml +++ b/src/setup-docker/templates/fabric-config/configtx.yaml @@ -35,6 +35,10 @@ Organizations: Name: <%= org.mspName %> ID: <%= org.mspName %> MSPDir: crypto-config/peerOrganizations/<%= org.domain %>/msp + <%_ if (global.capabilities.isV3) { _%> + OrdererEndpoints:<% ordererGroups[0].orderers.forEach(function(orderer) { %> + - <%= orderer.fullAddress %><% }) -%> + <%_ } _%> Policies: Readers: @@ -89,8 +93,10 @@ Application: &ApplicationDefaults <%_ ordererGroups.forEach(function(ordererGroup) { _%> Orderer: &<%= ordererGroup.configtxOrdererDefaults %> OrdererType: <%= ordererGroup.consensus %> + <%_ if (!global.capabilities.isV3) { _%> Addresses:<% ordererGroup.orderers.forEach(function(orderer) { %> - <%= orderer.fullAddress %><% })-%> + <%_ } _%> <%- include('configtx-raft-template.yaml.ejs', {ordererGroup: ordererGroup}); %> BatchTimeout: 2s BatchSize: diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9b6232f6a..809ac9777 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -56,7 +56,11 @@ services: <%= org.cli.address %>: container_name: <%= org.cli.address %> + <%_ if(global.capabilities.isV3) { _%> + image: ghcr.io/fablo-io/fabric-tools:${FABRIC_TOOLS_VERSION} + <%_ } else { _%> image: hyperledger/fabric-tools:${FABRIC_TOOLS_VERSION} + <%_ } _%> tty: true environment: - GOPATH=/opt/gopath diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index da91a34be..6f7a094cb 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -95,7 +95,7 @@ createChannelTx() { --name $CONTAINER_NAME \ -v "$CONFIG_PATH":/fabric-config \ -v "$OUTPUT_PATH":/output \ - hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ + ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -136,7 +136,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/src/validate/index.ts b/src/validate/index.ts index fd7044f53..08b4d901e 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -98,7 +98,7 @@ class ValidateGenerator extends Generator { // === Validate Orderers ============= this._validateIfOrdererDefinitionExists(networkConfig.orgs); - networkConfig.orgs.forEach((org) => this._validateOrdererCountForSoloType(org.orderers)); + networkConfig.orgs.forEach((org) => this._validateOrdererCountForSoloType(org.orderers, networkConfig.global)); networkConfig.orgs.forEach((org) => this._validateOrdererForRaftType(org.orderers, networkConfig.global)); networkConfig.orgs.forEach((org) => this._validateOrdererCountForOrg(org)); networkConfig.orgs.forEach((org) => this._validateOrdererGroupNameUniqueForOrg(org)); @@ -124,16 +124,7 @@ class ValidateGenerator extends Generator { } private _validateFabricVersion(global: GlobalJson) { - // 1. we support fabric up to 3.0.0-beta - if (version(global.fabricVersion).isGreaterOrEqual("3.0.0") && global.fabricVersion !== "3.0.0-beta") { - const objectToEmit = { - category: validationCategories.CRITICAL, - message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric up to 3.0.0-beta.`, - }; - this.emit(validationErrorType.CRITICAL, objectToEmit); - } - - // 2. we support Fabric starting from 2.0.0 + // we support Fabric starting from 2.0.0 if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { const objectToEmit = { category: validationCategories.CRITICAL, @@ -246,15 +237,25 @@ class ValidateGenerator extends Generator { } } - _validateOrdererCountForSoloType(orderers: OrdererJson[] | undefined) { + _validateOrdererCountForSoloType(orderers: OrdererJson[] | undefined, global: GlobalJson) { if (orderers !== undefined) { orderers.forEach((orderer) => { - if (orderer.type === "solo" && orderer.instances > 1) { - const objectToEmit = { - category: validationCategories.ORDERER, - message: `Orderer consesus type is set to 'solo', but number of instances is ${orderer.instances}. Only 1 instance will be created.`, - }; - this.emit(validationErrorType.WARN, objectToEmit); + if (orderer.type === "solo") { + if (version(global.fabricVersion).isGreaterOrEqual("3.0.0")) { + const objectToEmit = { + category: validationCategories.ORDERER, + message: `Solo consensus type is not supported in Fabric version ${global.fabricVersion}. Please use 'raft' or 'bft' instead.`, + }; + this.emit(validationErrorType.ERROR, objectToEmit); + } + + if (orderer.instances > 1) { + const objectToEmit = { + category: validationCategories.ORDERER, + message: `Orderer consesus type is set to 'solo', but number of instances is ${orderer.instances}. Only 1 instance will be created.`, + }; + this.emit(validationErrorType.WARN, objectToEmit); + } } }); } From 166d0108b2614d1b936e240e1a36b9ec5adcc60c Mon Sep 17 00:00:00 2001 From: Umegbewe Nwebedu Date: Fri, 21 Mar 2025 23:30:34 +0100 Subject: [PATCH 073/471] bump version 2.2.0 Signed-off-by: Umegbewe Nwebedu --- README.md | 8 ++++---- docs/sample.json | 2 +- docs/schema.json | 2 +- ...ablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap | 2 +- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- ...blo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 +++--- e2e/__snapshots__/schema.test.ts.snap | 2 +- fablo.sh | 2 +- package-lock.json | 4 ++-- package.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-k8s.json | 2 +- .../fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode.json | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml | 2 +- samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml | 2 +- .../fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- samples/fablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- 24 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 63b6a659d..cb7631880 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ You may keep the script in the root directory of your project or install it glob To install it globally: ```bash -sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo +sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo ``` To get a copy of Fablo for a single project, execute in the project root: ```bash -curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o ./fablo && chmod +x ./fablo +curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/fablo.sh -o ./fablo && chmod +x ./fablo ``` ## Getting started @@ -344,7 +344,7 @@ The basic structure of Fablo config file is as follows: ```json { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { ... }, "orgs": [ ... ], "channels": [ ... ], @@ -507,7 +507,7 @@ Genrated Hooks are saved in `fablo-target/hooks`. ```yaml --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json global: fabricVersion: 2.4.2 tls: false diff --git a/docs/sample.json b/docs/sample.json index 98635be5a..92b4c5f8c 100644 --- a/docs/sample.json +++ b/docs/sample.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": false, diff --git a/docs/schema.json b/docs/schema.json index 5959b4eae..a5548e3ee 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -12,7 +12,7 @@ ], "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json" + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json" }, "global": { "$id": "#/properties/global", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index d0652318e..7cff81ecf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -86,7 +86,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper REPOSITORY="https://kfsoftware.github.io/hlf-helm-charts" STORAGE_CLASS=$(kubectl describe sc | grep Name | tr -s ' ' | cut -d ':' -f 2 | cut -d ' ' -f 2) -FABLO_VERSION=2.1.0 +FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_CONFIG= ORDERER_IMAGE=hyperledger/fabric-orderer diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 1d6eadd1a..443075c3d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1524,7 +1524,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 27cf0a253..5b51acee7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1435,7 +1435,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index f241869fa..1b41b84e0 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2096,7 +2096,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 3e152f3c7..5331d1d88 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3019,7 +3019,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 978b75863..f62301fa5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3314,7 +3314,7 @@ fi `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index c3eaa266f..3ae1c9941 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1511,7 +1511,7 @@ fi `; exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 1a117eabe..5c3eb05d4 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1536,7 +1536,7 @@ fi `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 74c92c453..01450da29 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2965,7 +2965,7 @@ Validation warnings count: 0 exports[`init should init simple fablo config 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3019,7 +3019,7 @@ exports[`init should init simple fablo config 1`] = ` exports[`init should init simple fablo config with node chaincode 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3081,7 +3081,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` exports[`init should init simple fablo config with node chaincode and rest api 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index c93059f0d..6cd28ee15 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -7,7 +7,7 @@ exports[`schema should match snapshot 1`] = ` "default": {}, "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", }, "chaincodes": { "$id": "#/properties/chaincodes", diff --git a/fablo.sh b/fablo.sh index 92b2e0eae..17990e38c 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,7 +2,7 @@ set -e -FABLO_VERSION=2.1.0 +FABLO_VERSION=2.2.0 FABLO_IMAGE_NAME="ghcr.io/fablo-io/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" diff --git a/package-lock.json b/package-lock.json index 42ab6c18c..bf6e70126 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generator-fablo", - "version": "2.1.0", + "version": "2.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "generator-fablo", - "version": "2.1.0", + "version": "2.2.0", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index 4a88d1ebf..447b874cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-fablo", - "version": "2.1.0", + "version": "2.2.0", "description": "Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.", "author": "Piotr Hejwowski , Jakub Dzikowski ", "repository": { diff --git a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json index 629ba983e..207c02030 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.4.7", "tls": false, diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index fd7196f06..21e02b857 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.3.3", "tls": true, diff --git a/samples/fablo-config-hlf2-1org-1chaincode.json b/samples/fablo-config-hlf2-1org-1chaincode.json index fb890fff2..9efeca16b 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml index 4a31f8f39..6f3a00f66 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json global: fabricVersion: 2.4.7 tls: false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml index c3a944074..9f4c6a515 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json global: fabricVersion: 2.4.3 tls: true diff --git a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json index 91e0e3f6e..d34c0468d 100644 --- a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": true, diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index e6715804f..5c726ec6e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "3.0.0", "tls": true, diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index a35c76f07..c855db1aa 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, From f13cbc91cf24d031ed738092eeac611736edbcd1 Mon Sep 17 00:00:00 2001 From: Kalio <89003403+kalio007@users.noreply.github.com> Date: Fri, 11 Apr 2025 12:07:43 +0100 Subject: [PATCH 074/471] docs: clarify usage of global vs local fablo installation in README (#520) Signed-off-by: kalio007 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb7631880..5123feb4d 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,13 @@ curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/fablo To create a local Hyperledger Fabric network with Node.js chaincode and REST API client, install Fablo and execute: ```bash -./fablo init node rest +fablo init node rest # if installed globally +# or +./fablo init node rest # if using local script ./fablo up ``` -After a few minutes the whole network will be set up and running. +After a few minutes, the whole network will be set up and running. You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/fablo-io/fablo-rest)). ## Basic usage From 2b973437e8c59941ac520f93ac00321ebff138fd Mon Sep 17 00:00:00 2001 From: Vijeta Priya <67923889+VijetaPriya47@users.noreply.github.com> Date: Mon, 14 Apr 2025 00:48:30 +0530 Subject: [PATCH 075/471] Fix #519: Check if post-generate.sh exists before executing (#521) Signed-off-by: Vijeta Priya Co-authored-by: Vijeta Priya --- fablo.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fablo.sh b/fablo.sh index 17990e38c..b8a0c362c 100755 --- a/fablo.sh +++ b/fablo.sh @@ -191,7 +191,9 @@ generateNetworkConfig() { mkdir -p "$fablo_target" executeOnFabloDocker "fablo:setup-network" "$fablo_target" "$fablo_config" - ("$fablo_target/hooks/post-generate.sh") + if [ -f "$fablo_target/hooks/post-generate.sh" ]; then + ("$fablo_target/hooks/post-generate.sh") + fi } networkPrune() { From f5bcd0ab443ea1cec7f1c62a394a196dca375ef8 Mon Sep 17 00:00:00 2001 From: Debayan Ghosh <66942246+debayangg@users.noreply.github.com> Date: Mon, 14 Apr 2025 01:03:42 +0530 Subject: [PATCH 076/471] Updated fablo.sh to check if /hooks/post-generate.sh exists (#526) Signed-off-by: Debayan Ghosh Co-authored-by: Debayan Ghosh From 467b2ad8f42b3f20f003fc318a463e0df8e0fac7 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Sat, 10 May 2025 12:36:29 -0500 Subject: [PATCH 077/471] feat: support installing chaincode from Docker image using CCAAS This change adds support for 'ccaas'-based chaincodes by allowing the use of a Docker image instead of a directory. It introduces validation for the presence of image and port when lang is 'ccaas', and adjusts packaging and installation logic to handle CCAAS chaincodes. Signed-off-by: Pereowei Daniel Signed-off-by: Real-Artisan --- docs/schema.json | 40 +++++++++++++++++- e2e/__snapshots__/extendConfig.test.ts.snap | 22 ++++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 36 ++++++++++++++-- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 36 ++++++++++++++-- ...2chaincodes-private-data.yaml.test.ts.snap | 42 ++++++++++++++++--- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 42 ++++++++++++++++--- ...1chaincode-raft-explorer.json.test.ts.snap | 36 ++++++++++++++-- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 36 ++++++++++++++-- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 36 ++++++++++++++-- e2e/__snapshots__/schema.test.ts.snap | 38 +++++++++++++++++ e2e/schema.test.ts | 3 +- src/extend-config/extendChaincodesConfig.ts | 15 +++++++ .../chaincode-install-v2.sh | 6 ++- .../fabric-docker/docker-compose.yaml | 12 ++++++ .../scripts/chaincode-functions-v2.sh | 30 +++++++++++++ src/types/FabloConfigExtended.ts | 4 +- src/types/FabloConfigJson.ts | 6 ++- 17 files changed, 407 insertions(+), 33 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index a5548e3ee..645658096 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -439,7 +439,8 @@ "enum": [ "golang", "java", - "node" + "node", + "ccaas" ] }, "channel": { @@ -478,6 +479,19 @@ "title": "Chaincode directory", "type": "string" }, + "image": { + "$id": "#/properties/chaincodes/items/properties/image", + "title": "Chaincode image URI", + "type": "string", + "pattern": "^[a-zA-Z0-9\\.\\-]+$" + }, + "port": { + "$id": "#/properties/chaincodes/items/properties/port", + "title": "Chaincode port", + "type": "integer", + "minimum": 10, + "maximum": 65535 + }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "title": "Private data collections", @@ -522,6 +536,30 @@ } } } + }, + "required": [ + "name", + "version", + "lang", + "channel" + ], + "if": { + "properties": { + "lang": { + "const": "ccaas" + } + } + }, + "then": { + "required": [ + "image", + "port" + ] + }, + "else": { + "required": [ + "directory" + ] } }, "hooks": { diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index ee52ee4fb..7a9da733a 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -244,6 +244,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -334,6 +335,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1070,6 +1072,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1160,6 +1163,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1886,6 +1890,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1971,6 +1976,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -2760,6 +2766,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "OR('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -2850,6 +2857,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "or-policy-chaincode", + "port": undefined, "privateData": [ { "blockToLive": 0, @@ -3168,6 +3176,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -3258,6 +3267,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "and-policy-chaincode", + "port": undefined, "privateData": [ { "blockToLive": 0, @@ -4237,6 +4247,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "OR ('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -4332,6 +4343,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -4684,6 +4696,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "directory": "./chaincodes/chaincode-java-simple", "endorsement": "OR ('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -4779,6 +4792,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "java", "name": "chaincode2", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -6804,6 +6818,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -6942,6 +6957,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -9429,6 +9445,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND ('Org1MSP.member')", + "image": undefined, "init": "{"Args":[]}", "instantiatingOrg": { "anchorPeers": [ @@ -9519,6 +9536,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -10387,6 +10405,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND ('Org1MSP.member')", + "image": undefined, "init": "{"Args":[]}", "instantiatingOrg": { "anchorPeers": [ @@ -10477,6 +10496,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11302,6 +11322,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11387,6 +11408,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 443075c3d..a10131dc1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1727,7 +1727,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" @@ -1756,7 +1756,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" @@ -1803,7 +1803,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" @@ -2560,13 +2560,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 5b51acee7..f02bbcc80 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1680,7 +1680,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1710,7 +1710,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1758,7 +1758,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -2428,13 +2428,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 1b41b84e0..54c4d0126 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2397,7 +2397,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2414,7 +2414,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2447,7 +2447,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2466,7 +2466,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2529,7 +2529,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2548,7 +2548,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -3355,13 +3355,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 5331d1d88..66c590019 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3523,7 +3523,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3539,7 +3539,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3571,7 +3571,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3589,7 +3589,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3651,7 +3651,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3669,7 +3669,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -4764,13 +4764,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index f62301fa5..7d4d71c02 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3861,7 +3861,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3891,7 +3891,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3939,7 +3939,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -5276,13 +5276,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 3ae1c9941..dea7b8492 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1768,7 +1768,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1798,7 +1798,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1834,7 +1834,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2678,13 +2678,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 5c3eb05d4..c9c59c029 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1792,7 +1792,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1822,7 +1822,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1858,7 +1858,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2702,13 +2702,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6cd28ee15..1afa58a40 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -22,6 +22,18 @@ exports[`schema should match snapshot 1`] = ` "version": "0.0.1", }, ], + "else": { + "required": [ + "directory", + ], + }, + "if": { + "properties": { + "lang": { + "const": "ccaas", + }, + }, + }, "items": { "$id": "#/properties/chaincodes/items", "properties": { @@ -51,6 +63,12 @@ exports[`schema should match snapshot 1`] = ` "title": "Endorsement configuration", "type": "string", }, + "image": { + "$id": "#/properties/chaincodes/items/properties/image", + "pattern": "^[a-zA-Z0-9\\.\\-]+$", + "title": "Chaincode image URI", + "type": "string", + }, "init": { "$id": "#/properties/chaincodes/items/properties/init", "title": "Initialization arguments (for Hyperledger Fabric below 2.0)", @@ -67,6 +85,7 @@ exports[`schema should match snapshot 1`] = ` "golang", "java", "node", + "ccaas", ], "title": "Language", "type": "string", @@ -77,6 +96,13 @@ exports[`schema should match snapshot 1`] = ` "title": "Name", "type": "string", }, + "port": { + "$id": "#/properties/chaincodes/items/properties/port", + "maximum": 65535, + "minimum": 10, + "title": "Chaincode port", + "type": "integer", + }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "items": { @@ -137,6 +163,18 @@ exports[`schema should match snapshot 1`] = ` "title": "Chaincode", "type": "object", }, + "required": [ + "name", + "version", + "lang", + "channel", + ], + "then": { + "required": [ + "image", + "port", + ], + }, "title": "Chaincodes", "type": "array", }, diff --git a/e2e/schema.test.ts b/e2e/schema.test.ts index 40a3b87ee..2a2e7c9f4 100644 --- a/e2e/schema.test.ts +++ b/e2e/schema.test.ts @@ -251,12 +251,13 @@ describe("schema", () => { it("should validate chaincode language", () => { const withChaincodeLanguage = (l: string) => updatedBase((json: FabloConfigJson) => { - json.chaincodes[0].lang = l as "java" | "golang" | "node"; + json.chaincodes[0].lang = l as "java" | "golang" | "node" | "ccaas"; }); expect(withChaincodeLanguage("java")).toMatchSchema(schema); expect(withChaincodeLanguage("node")).toMatchSchema(schema); expect(withChaincodeLanguage("golang")).toMatchSchema(schema); + expect(withChaincodeLanguage("ccaas")).toMatchSchema(schema); expect(withChaincodeLanguage("cobol")).not.toMatchSchema(schema); }); diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index da7982046..dad6f852b 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -57,12 +57,27 @@ const extendChaincodesConfig = ( ); const privateDataConfigFile = privateData.length > 0 ? `collections/${chaincode.name}.json` : undefined; + if (chaincode.lang === "ccaas") { + if (!chaincode.image) { + throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify an image field`); + } + if (!chaincode.port) { + throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify a port field`); + } + } else { + if (!chaincode.directory) { + throw new Error(`Chaincode '${chaincode.name}' must specify a directory field when not of type 'ccaas'`); + } + } + return { directory: chaincode.directory, name: chaincode.name, version: chaincode.version, lang: chaincode.lang, channel, + image: chaincode.image, + port: chaincode.port, ...initParams, endorsement, instantiatingOrg: channel.instantiatingOrg, diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 8455856ee..3709e76cc 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -8,17 +8,21 @@ - global */-%> printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" -chaincodeBuild <% -%> +<% if (!chaincode.image) { -%> + chaincodeBuild <% -%> "<%= chaincode.name %>" <% -%> "<%= chaincode.lang %>" <% -%> "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> "<%= global.fabricRecommendedNodeVersion %>" +<% } -%> chaincodePackage <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> "<%= chaincode.name %>" <% -%> "$version" <% -%> "<%= chaincode.lang %>" <% -%> + "<%= chaincode.image || '' %>" <% -%> + "<%= chaincode.port || '' %>" <% -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" <% org.peers.forEach((peer) => { -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 809ac9777..60715b100 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -2,6 +2,18 @@ networks: basic: services: +<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> + <%= chaincode.name%>: + container_name: <%= chaincode.name %> + image: <%= chaincode.image %> + environment: + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= chaincode.port %> + - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + ports: + - "<%= chaincode.port %>:<%= chaincode.port %>" + networks: + - basic +<% } }) %> <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index f35d4c26d..2b453325a 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -87,13 +87,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\"type\":\"ccaas\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\"address\":\"$CHAINCODE_NAME:$CHAINCODE_PORT\",\"dial_timeout\":\"10s\",\"tls_required\":false}" > "$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \ diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 65de5bc14..50ce55372 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -146,11 +146,13 @@ export interface OrgConfig { } export interface ChaincodeConfig { - directory: string; + directory?: string; name: string; version: string; lang: string; channel: ChannelConfig; + image?: string; + port?: number; init?: string; initRequired?: boolean; endorsement?: string; diff --git a/src/types/FabloConfigJson.ts b/src/types/FabloConfigJson.ts index bc50f916b..d43e78bde 100644 --- a/src/types/FabloConfigJson.ts +++ b/src/types/FabloConfigJson.ts @@ -54,12 +54,14 @@ export interface PrivateDataJson { export interface ChaincodeJson { name: string; version: string; - lang: "node" | "java" | "golang"; + lang: "node" | "java" | "golang" | "ccaas"; channel: string; init?: string; initRequired?: boolean; endorsement?: string; - directory: string; + directory?: string; + image?: string; + port?: number; privateData: PrivateDataJson[]; } From 1eb0a9b23229335f7120ab18a25e09be9efa9bcf Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Wed, 4 Jun 2025 05:46:56 -0500 Subject: [PATCH 078/471] Keep cc container running ang generate dynamic ports Signed-off-by: Real-Artisan --- docs/schema.json | 45 +- e2e-network/docker/test-04-snapshot.sh | 15 + e2e/__snapshots__/extendConfig.test.ts.snap | 16 +- ...1chaincode-raft-explorer.json.test.ts.snap | 3348 +---------------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 16 +- ...2chaincodes-private-data.yaml.test.ts.snap | 25 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 25 +- ...1chaincode-raft-explorer.json.test.ts.snap | 16 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 16 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 16 +- e2e/__snapshots__/schema.test.ts.snap | 48 +- .../chaincodes/chaincode-kv-node/Dockerfile | 12 + .../chaincodes/chaincode-kv-node/package.json | 1 + ...ig-hlf2-1org-1chaincode-raft-explorer.json | 14 +- src/extend-config/extendChaincodesConfig.ts | 47 +- src/setup-docker/index.ts | 19 + .../fabric-docker/ccaas_builder/bin/build | 21 + .../fabric-docker/ccaas_builder/bin/detect | 11 + .../fabric-docker/ccaas_builder/bin/release | 11 + .../chaincode-install-v2.sh | 44 +- .../fabric-docker/docker-compose.yaml | 18 +- .../scripts/chaincode-functions-v2.sh | 25 +- src/types/FabloConfigExtended.ts | 6 + src/validate/index.ts | 42 +- test-output.txt | 64 + 25 files changed, 396 insertions(+), 3525 deletions(-) create mode 100644 samples/chaincodes/chaincode-kv-node/Dockerfile create mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build create mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect create mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release create mode 100644 test-output.txt diff --git a/docs/schema.json b/docs/schema.json index 645658096..58386a986 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -416,8 +416,20 @@ "name", "version", "lang", - "channel", - "directory" + "channel" + ], + "allOf": [ + { + "if": { + "properties": { "lang": { "const": "ccaas_builder"}} + }, + "then": { + "required": [ "image"] + }, + "else": { + "required": [ "directory" ] + } + } ], "properties": { "name": { @@ -440,7 +452,7 @@ "golang", "java", "node", - "ccaas" + "ccaas_builder" ] }, "channel": { @@ -482,8 +494,7 @@ "image": { "$id": "#/properties/chaincodes/items/properties/image", "title": "Chaincode image URI", - "type": "string", - "pattern": "^[a-zA-Z0-9\\.\\-]+$" + "type": "string" }, "port": { "$id": "#/properties/chaincodes/items/properties/port", @@ -536,30 +547,6 @@ } } } - }, - "required": [ - "name", - "version", - "lang", - "channel" - ], - "if": { - "properties": { - "lang": { - "const": "ccaas" - } - } - }, - "then": { - "required": [ - "image", - "port" - ] - }, - "else": { - "required": [ - "directory" - ] } }, "hooks": { diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index a952d6fa0..33c6bcf1f 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -5,10 +5,23 @@ set -e TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." +REGISTRY_PORT=5000 +REGISTRY_NAME="fablo-test-case-ccaas" +CHAINCODE_IMAGE="localhost:$REGISTRY_PORT/fablo-test-case-ccaas:0.0.1" export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json" +CHAINCODE_SRC="$FABLO_HOME/samples/chaincodes/chaincode-kv-node" + +echo "Starting local registry on port $REGISTRY_PORT" +docker run -d -p "$REGISTRY_PORT:$REGISTRY_PORT" --restart=always --name $REGISTRY_NAME registry:2 || true + +echo "Building CCAAS chaincode image..." +docker build -t "$CHAINCODE_IMAGE" "$CHAINCODE_SRC" + +echo "Pushing chaincode image to local registry..." +docker push "$CHAINCODE_IMAGE" networkUp() { "$FABLO_HOME/fablo-build.sh" @@ -25,6 +38,7 @@ networkDown() { sleep 2 (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) + docker rm -f "$REGISTRY_NAME" || true } waitForContainer() { @@ -57,6 +71,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" +waitForContainer "chaincode1-peer0.org1.example.com" "Starting chaincode container from image" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 7a9da733a..494b8ba45 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1888,9 +1888,9 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1974,9 +1974,9 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "port": undefined, + "port": 7052, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11320,9 +11320,9 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11406,9 +11406,9 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "port": undefined, + "port": 7052, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index a10131dc1..b79c8f74e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3349 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"/config -/crypto-config -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"################################################################################ -# SECTION: Capabilities -################################################################################ -Capabilities: - Channel: &ChannelCapabilities - V2_0: true - Orderer: &OrdererCapabilities - V2_0: true - Application: &ApplicationCapabilities - V2_0: true - -################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - EtcdRaft: - Consenters: - - Host: orderer0.group1.orderer.example.com - Port: 7030 - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 1 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Orderer - - *Org1 - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *ApplicationCapabilities - Consortium: SampleConsortium - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-orderer", - "description": "Connection profile for Orderer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Orderer" - }, - "organizations": { - "Orderer": { - "mspid": "OrdererMSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.orderer.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.orderer.example.com": { - "url": "https://localhost:7020", - "caName": "ca.orderer.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-orderer -description: Connection profile for Orderer in Fablo network -version: 1.0.0 -client: - organization: Orderer -organizations: - Orderer: - mspid: OrdererMSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.orderer.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.orderer.example.com: - url: https://localhost:7020 - caName: ca.orderer.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Org1 in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1" - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.org1.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.org1.example.com": { - "url": "https://localhost:7040", - "caName": "ca.org1.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-org1 -description: Connection profile for Org1 in Fablo network -version: 1.0.0 -client: - organization: Org1 -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.org1.example.com: - url: https://localhost:7040 - caName: ca.org1.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - Template: - Count: 0 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Org1 - Domain: org1.example.com - Specs: - Template: - Count: 1 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Hyperledger Explorer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1", - "tlsEnable": true, - "enableAuthentication": true, - "adminCredential": { - "id": "admin", - "password": "adminpw" - }, - "connection": { - "timeout": { - "peer": { - "endorser": "300" - }, - "orderer": "300" - } - } - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "adminPrivateKey": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" - }, - "peers": [ - "peer0.org1.example.com" - ], - "signedCert": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" - } - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://peer0.org1.example.com:7041", - "tlsCACerts": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" - } - } - }, - "channels": { - "my-channel1": { - "peers": {} - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - orderer: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - org1: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - notifyOrgsAboutChannels - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "\${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "\${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.2.0 -FABLO_BUILD= -FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 - -COUCHDB_VERSION=3.1 -FABRIC_COUCHDB_VERSION=0.4.18 - -FABLO_CONFIG= -CHAINCODES_BASE_DIR= - -COMPOSE_PROJECT_NAME= -LOGGING_LEVEL=info - -FABRIC_VERSION=2.3.3 -FABRIC_TOOLS_VERSION=2.3.3 -FABRIC_CA_VERSION=1.5.5 -FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=2.3.3 -FABRIC_BASEOS_VERSION=2.3.3 -FABRIC_JAVAENV_VERSION=2.3 -FABRIC_NODEENV_VERSION=2.3 -RECOMMENDED_NODE_VERSION=12 - -ROOT_CA_ADMIN_NAME=admin -ROOT_CA_ADMIN_PASSWORD=adminpw - -ORDERER_CA_ADMIN_NAME=admin -ORDERER_CA_ADMIN_PASSWORD=adminpw - -ORG1_CA_ADMIN_NAME=admin -ORG1_CA_ADMIN_PASSWORD=adminpw - -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -chaincodeList() { - if [ "$#" -ne 2 ]; then - echo "Expected 2 parameters for chaincode list, but got: $*" - exit 1 - - elif [ "$1" = "peer0.org1.example.com" ]; then - - peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - - else - - echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" - exit 1 - - fi -} - -# Function to perform chaincode invoke. Accepts 5 parameters: -# 1. comma-separated peers -# 2. channel name -# 3. chaincode name -# 4. chaincode command -# 5. transient data (optional) -chaincodeInvoke() { - if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then - echo "Expected 4 or 5 parameters for chaincode list, but got: $*" - echo "Usage: fablo chaincode invoke [transient]" - exit 1 - fi - cli="" - peer_addresses="" - - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then - cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi - - if [ "$2" = "my-channel1" ]; then - ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" - fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" - -set -eu - -channelQuery() { - echo "-> Channel query: " + "$@" - - if [ "$#" -eq 1 ]; then - printChannelsHelp - - elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then - - peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif - - [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] - then - - peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - TARGET_FILE=\${6:-"$channel-config.json"} - - peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - BLOCK_NAME=$2 - TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - - peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - - else - - echo "$@" - echo "$1, $2, $3, $4, $5, $6, $7, $#" - printChannelsHelp - fi - -} - -printChannelsHelp() { - echo "Channel management commands:" - echo "" - - echo "fablo channel list org1 peer0" - echo -e "\\t List channels on 'peer0' of 'Org1'". - echo "" - - echo "fablo channel getinfo my-channel1 org1 peer0" - echo -e "\\t Get channel info on 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" - echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch my-channel1 org1 peer0 [file name]" - echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -generateArtifacts() { - printHeadline "Generating basic configs" "U1F913" - - printItalics "Generating crypto material for Orderer" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating crypto material for Org1" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating genesis block for group group1" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - - # Create directories to avoid permission errors on linux - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -startNetwork() { - printHeadline "Starting network" "U1F680" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - sleep 4 -} - -generateChannelsArtifacts() { - printHeadline "Generating config for 'my-channel1'" "U1F913" - createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -installChannels() { - printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - -} - -installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then - local version="0.0.1" - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - else - echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" - fi - -} - -installChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" - fi - fi -} - -runDevModeChaincode() { - local chaincodeName=$1 - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - local version="0.0.1" - printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" - - fi -} - -upgradeChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" - fi - fi -} - -notifyOrgsAboutChannels() { - - printHeadline "Creating new channel config blocks" "U1F537" - createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" - - printHeadline "Notyfing orgs about channels" "U1F4E2" - notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - printHeadline "Deleting new channel config blocks" "U1F52A" - deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" - -} - -printStartSuccessInfo() { - printHeadline "Done! Enjoy your fresh network" "U1F984" -} - -stopNetwork() { - printHeadline "Stopping network" "U1F68F" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) - sleep 4 -} - -networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do - echo "Removing container $container..." - docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" - done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do - echo "Removing image $image..." - docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" - done - - printf "Removing generated configs... \\U1F5D1 \\n" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - - printHeadline "Done! Network was purged" "U1F5D1" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Genesis file configuration (for solo and raft) - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_DB_TLS_ENABLED=false - - FABRIC_CA_SERVER_DB_TYPE=postgres - - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - depends_on: - db.ca.org1.example.com: - condition: service_healthy - networks: - - basic - - db.ca.org1.example.com: - container_name: db.ca.org1.example.com - image: postgres:\${FABRIC_CA_POSTGRES_VERSION} - environment: - - POSTGRES_PASSWORD=caDbPass12345 - - POSTGRES_USER=postgres - - POSTGRES_DB=fabriccaserver - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - fablo-rest.org1.example.com: - container_name: fablo-rest.org1.example.com - image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} - environment: - - PORT=8000 - - MSP_ID=Org1MSP - - FABRIC_CA_URL=https://ca.org1.example.com:7054 - - FABRIC_CA_NAME=ca.org1.example.com - - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 - - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - HFC_LOGGING={"error":"console","warn":"console","info":"console"} - volumes: - # note: fablo needs access to all anchor peer certs - - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro - ports: - - 8801:8000 - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - depends_on: - couchdb.peer0.org1.example.com: - condition: service_healthy - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: couchdb:\${COUCHDB_VERSION} - environment: - - COUCHDB_USER=peer0 - - COUCHDB_PASSWORD=peer0Password - healthcheck: - test: "curl -f http://localhost:5984/" - interval: 5s - timeout: 10s - retries: 7 - ports: - - 5100:5984 - networks: - - basic - - db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} - container_name: db.explorer.example.com - environment: - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWORD=password - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} - restart: on-failure:8 - container_name: explorer.example.com - environment: - - DATABASE_HOST=db.explorer.example.com - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWD=password - - LOG_LEVEL_APP=debug - - LOG_LEVEL_DB=debug - - LOG_LEVEL_CONSOLE=info - - LOG_CONSOLE_STDOUT=true - - DISCOVERY_AS_LOCALHOST=false - volumes: - - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json - - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile - - ../fabric-config/crypto-config:/tmp/crypto - ports: - - "7010:8080" - depends_on: - db.explorer.example.com: - condition: service_healthy - networks: - - basic -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -certsGenerate() { - local CONTAINER_NAME=certsGenerate - - local CONFIG_PATH=$1 - local CRYPTO_CONFIG_FILE_NAME=$2 - local ORG_PATH=$3 - local OUTPUT_PATH=$4 - local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH - - echo "Generating certs..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" - inputLog "ORG_PATH: $ORG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" - - if [ -d "$FULL_CERT_PATH" ]; then - echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME - - docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME - - # shellcheck disable=2044 - for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do - dir=$(dirname "$file") - mv "\${dir}"/*_sk "\${dir}"/priv-key.pem - done -} - -genesisBlockCreate() { - local CONTAINER_NAME=genesisBlockCreate - - local CONFIG_PATH=$1 - local OUTPUT_PATH=$2 - local GENESIS_PROFILE_NAME=$3 - local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block - - echo "Creating genesis block..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" - inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" - - if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then - echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME - - mkdir -p "$OUTPUT_PATH" - docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createChannelTx() { - local CONTAINER_NAME=createChannelTx - - local CHANNEL_NAME=$1 - local CONFIG_PATH=$2 - local CONFIG_PROFILE=$3 - local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx - - echo "Creating channelTx for $CHANNEL_NAME..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" - - if [ -f "$CHANNEL_TX_PATH" ]; then - echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createNewChannelUpdateTx() { - local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CONFIG_PROFILE=$3 - local CONFIG_PATH=$4 - local OUTPUT_PATH=$5 - - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then - echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen \\ - --configPath ./fabric-config \\ - -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ - -channelID "\${CHANNEL_NAME}" \\ - -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - - docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -notifyOrgAboutNewChannel() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -notifyOrgAboutNewChannelTls() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - local CA_CERT="/var/hyperledger/cli/"\${6} - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" \\ - --tls --cafile "$CA_CERT" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -deleteNewChannelUpdateTx() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" - inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -printHeadline() { - bold=$'\\e[1m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -printItalics() { - italics=$'\\e[3m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -inputLog() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -inputLogShort() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -certsRemove() { - local CERTS_DIR_PATH=$1 - rm -rf "$CERTS_DIR_PATH" -} - -removeContainer() { - CONTAINER_NAME=$1 - docker rm -f "$CONTAINER_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -printHelp() { - echo "Fablo is powered by SoftwareMill" - - echo "" - echo "usage: ./fabric-docker.sh " - echo "" - - echo "Commands: " - echo "" - echo "./fabric-docker.sh up" - echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." - echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" - echo "" - echo "./fabric-docker.sh down" - echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." - echo "" - echo "./fabric-docker.sh start" - echo -e "\\t Starts already created network." - echo "" - echo "./fabric-docker.sh stop" - echo -e "\\t Stops already running network." - echo "" - echo "./fabric-docker.sh reset" - echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." - echo "" - echo "./fabric-docker.sh channel --help" - echo -e "\\t Detailed help for channel management scripts." - echo "" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash -# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. -# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u - -dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" - fi -} - -node_version_check() { - - local fabric_shim_version="$1" - local nodejs_version - - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 - - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 - - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 - - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 - - else - nodejs_version=18.12 - fi - - echo $nodejs_version - -} - -chaincodeBuild() { - local CHAINCODE_NAME=$1 - local CHAINCODE_LANG=$2 - local CHAINCODE_DIR_PATH=$3 - local RECOMMENDED_NODE_VERSION=$4 - - mkdir -p "$CHAINCODE_DIR_PATH" - - # pull required images upfront in case of arm64 (Apple Silicon) architecture - # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately - # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly - if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then - if [ "$CHAINCODE_LANG" = "node" ]; then - dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "java" ]; then - dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "golang" ]; then - dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" - fi - fi - - if [ "$CHAINCODE_LANG" = "node" ]; then - NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") - RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") - - if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then - echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" - echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" - fi - - echo "Buiding chaincode '$CHAINCODE_NAME'..." - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" - inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - - # Default to using npm for installation and build - (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - - fi -} - -chaincodePackage() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" - - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi - - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodeInstall() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CA_CERT=$5 - - echo "Installing chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA_CERT: $CA_CERT" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") - fi - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeApprove() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COLLECTIONS_CONFIG=\${10} - - echo "Approving chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYINSTALLED_RESPONSE - local CC_PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - if [ -z "$CC_PACKAGE_ID" ]; then - CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" - fi - inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --package-id "$CC_PACKAGE_ID" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeCommit() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COMMIT_PEER_ADDRESSES=\${10} - local TLS_ROOT_CERT_FILES=\${11} - local COLLECTIONS_CONFIG=\${12} - - echo "Committing chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" - inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local COMMIT_PEER_PARAMS=() - if [ -n "$COMMIT_PEER_ADDRESSES" ]; then - # shellcheck disable=SC2207 - COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) - fi - - local TLS_ROOT_CERT_PARAMS=() - if [ -n "$TLS_ROOT_CERT_FILES" ]; then - # shellcheck disable=SC2207 - TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ - "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -peerChaincodeList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - - # Execute the command to list chaincodes - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" -} - -peerChaincodeListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - local CA_CERT=$4 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CA_CERT: $CA_CERT" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" -} - -# Function to perform chaincode invoke -peerChaincodeInvoke() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - 2>&1 -} -# Function to perform chaincode invoke for Tls -peerChaincodeInvokeTls() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - local PEER_CERTS="$7" - local CA_CERT="$8" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - inputLog "PEER_CERTS: $PEER_CERTS" - inputLog "CA_CERT: $CA_CERT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - $TLS_ROOT_CERT_FILES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" \\ - 2>&1 -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -peerChannelList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list -} - -peerChannelGetInfo() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" -} - -peerChannelFetchConfig() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlock() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local TARGET_FILE="$5" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} - -#=== TLS equivalents ========================================================= - -peerChannelListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CA_CERT=$3 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" -} - -peerChannelGetInfoTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - local CA_CERT=$4 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" -} - -peerChannelFetchConfigTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - local CA_CERT=$5 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlockTls() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local CA_CERT="$5" - local TARGET_FILE="$6" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -createChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx - peer channel join -b "\${CHANNEL_NAME}".block - - rm -rf "$DIR_NAME" -} - -createChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" - peer channel join -b "\${CHANNEL_NAME}"_newest.block - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -__getOrdererAndPeerNodes() { - echo " - orderer0.group1.orderer.example.com - peer0.org1.example.com - " -} - -__getCASQLiteNodes() { - echo " - ca.orderer.example.com - " -} - -__getCAPostgresNodes() { - echo " - db.ca.org1.example.com - " -} - -__createSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" - - if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then - echo "Error: Directory '$backup_dir' already exists and is not empty!" - exit 1 - fi - - mkdir -p "$backup_dir" - cp -R ./fablo-target "$backup_dir/" - - for node in $(__getCASQLiteNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node" - docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" - done - - for node in $(__getCAPostgresNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node/pg-data" - docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Saving state of $node..." - docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" - done -} - -__cloneSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - target_dir="$1" - hook_cmd="$2" - - if [ -d "$target_dir/fablo-target" ]; then - echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." - exit 1 - fi - - cp -R ./fablo-target "$target_dir/fablo-target" - - if [ -n "$hook_cmd" ]; then - echo "Executing pre-restore hook: '$hook_cmd'" - (cd "$target_dir" && eval "$hook_cmd") - fi - - (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) - - for node in $(__getCASQLiteNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" - fi - done - - for node in $(__getCAPostgresNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" - fi - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/" "$node:/var/hyperledger/production/" - fi - done -} - -createSnapshot() { - (set -eu && __createSnapshot "$1") -} - -cloneSnapshot() { - (set -eu && __cloneSnapshot "$1" "$2") -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -# The code from this file was called after Fablo generated Hyperledger Fabric configuration -echo "Executing post-generate hook" - -perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -[ - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", -] -`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index f02bbcc80..ce77dfe03 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1680,7 +1680,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1710,7 +1711,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1758,7 +1760,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -2430,6 +2433,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -2438,17 +2442,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -2459,6 +2464,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 54c4d0126..0bb466a84 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2397,7 +2397,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2414,7 +2415,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2447,7 +2449,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2466,7 +2469,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2529,7 +2533,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2548,7 +2553,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -3357,6 +3363,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -3365,17 +3372,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -3386,6 +3394,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 66c590019..636e12a37 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3523,7 +3523,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3539,7 +3540,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" + printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3571,7 +3573,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3589,7 +3592,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" + printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3651,7 +3655,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3669,7 +3674,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" + printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -4766,6 +4772,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -4774,17 +4781,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -4795,6 +4803,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 7d4d71c02..be83549d6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3861,7 +3861,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3891,7 +3892,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3939,7 +3941,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -5278,6 +5281,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -5286,17 +5290,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -5307,6 +5312,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index dea7b8492..da1c8ff76 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1768,7 +1768,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1798,7 +1799,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1834,7 +1836,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2680,6 +2683,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -2688,17 +2692,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -2709,6 +2714,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index c9c59c029..2655c37cd 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1792,7 +1792,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1822,7 +1823,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1858,7 +1860,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2704,6 +2707,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -2712,17 +2716,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -2733,6 +2738,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 1afa58a40..d6b97b808 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -22,20 +22,30 @@ exports[`schema should match snapshot 1`] = ` "version": "0.0.1", }, ], - "else": { - "required": [ - "directory", - ], - }, - "if": { - "properties": { - "lang": { - "const": "ccaas", - }, - }, - }, "items": { "$id": "#/properties/chaincodes/items", + "allOf": [ + { + "else": { + "required": [ + "directory", + ], + }, + "if": { + "properties": { + "lang": { + "const": "ccaas", + }, + }, + }, + "then": { + "required": [ + "image", + "port", + ], + }, + }, + ], "properties": { "channel": { "$id": "#/properties/chaincodes/items/properties/channel", @@ -65,7 +75,6 @@ exports[`schema should match snapshot 1`] = ` }, "image": { "$id": "#/properties/chaincodes/items/properties/image", - "pattern": "^[a-zA-Z0-9\\.\\-]+$", "title": "Chaincode image URI", "type": "string", }, @@ -158,23 +167,10 @@ exports[`schema should match snapshot 1`] = ` "version", "lang", "channel", - "directory", ], "title": "Chaincode", "type": "object", }, - "required": [ - "name", - "version", - "lang", - "channel", - ], - "then": { - "required": [ - "image", - "port", - ], - }, "title": "Chaincodes", "type": "array", }, diff --git a/samples/chaincodes/chaincode-kv-node/Dockerfile b/samples/chaincodes/chaincode-kv-node/Dockerfile new file mode 100644 index 000000000..8f6607602 --- /dev/null +++ b/samples/chaincodes/chaincode-kv-node/Dockerfile @@ -0,0 +1,12 @@ +FROM node:18 + +WORKDIR /usr/src/app + +COPY package*.json ./ +RUN npm install + +COPY . . + +EXPOSE 7052 + +CMD ["npm", "run", "start:ccaas"] \ No newline at end of file diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index 5314d7394..58ef74226 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -8,6 +8,7 @@ }, "scripts": { "start": "fabric-chaincode-node start", + "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\" ", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 21e02b857..23b8be15e 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,11 +1,8 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", + "$schema": "../docs/schema.json", "global": { "fabricVersion": "2.3.3", - "tls": true, - "tools": { - "explorer": true - } + "tls": true }, "orgs": [ { @@ -32,9 +29,6 @@ "peer": { "instances": 1, "db": "CouchDb" - }, - "tools": { - "fabloRest": true } } ], @@ -55,9 +49,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas_builder", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "image": "localhost:5000/fablo-test-case-ccaas:0.0.1" } ], "hooks": { diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index dad6f852b..fcbb81c97 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -42,6 +42,7 @@ const extendChaincodesConfig = ( transformedChannels: ChannelConfig[], network: Global, ): ChaincodeConfig[] => { + let portCounter = 7052; return chaincodes.map((chaincode) => { const channel = transformedChannels.find((c) => c.name === chaincode.channel); if (!channel) throw new Error(`No matching channel with name '${chaincode.channel}'`); @@ -57,33 +58,35 @@ const extendChaincodesConfig = ( ); const privateDataConfigFile = privateData.length > 0 ? `collections/${chaincode.name}.json` : undefined; + const peerChaincodeInstances = !chaincode.image ? [] : channel.orgs.flatMap((org) => + org.peers.map((peer) => { + return { + containerName: `${peer.address}_${chaincode.name}`, + peerAddress: peer.address, + port: portCounter++, + }; + }) + ); + if (chaincode.lang === "ccaas") { if (!chaincode.image) { throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify an image field`); } - if (!chaincode.port) { - throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify a port field`); - } - } else { - if (!chaincode.directory) { - throw new Error(`Chaincode '${chaincode.name}' must specify a directory field when not of type 'ccaas'`); - } } - - return { - directory: chaincode.directory, - name: chaincode.name, - version: chaincode.version, - lang: chaincode.lang, - channel, - image: chaincode.image, - port: chaincode.port, - ...initParams, - endorsement, - instantiatingOrg: channel.instantiatingOrg, - privateDataConfigFile, - privateData, - }; + return { + directory: chaincode.directory, + name: chaincode.name, + version: chaincode.version, + lang: chaincode.lang, + channel, + image: chaincode.image, + ...initParams, + endorsement, + instantiatingOrg: channel.instantiatingOrg, + privateDataConfigFile, + peerChaincodeInstances, + privateData, + }; }); }; diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 081ea4890..e88a7804b 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -64,6 +64,7 @@ export default class SetupDockerGenerator extends Generator { // ======= fabric-docker =========================================================== this._copyDockerComposeEnv(global, orgs, composeNetworkName); this._copyDockerCompose(config); + this._copyBuildScripts(config); // ======= scripts ================================================================== this._copyCommandsGeneratedScript(config); @@ -178,6 +179,24 @@ export default class SetupDockerGenerator extends Generator { ); } + _copyBuildScripts(config: FabloConfigExtended): void { + this.fs.copyTpl( + this.templatePath("fabric-docker/ccaas_builder/bin/build"), + this.destinationPath("fabric-docker/ccaas_builder/bin/build"), + config, + ); + this.fs.copyTpl( + this.templatePath("fabric-docker/ccaas_builder/bin/detect"), + this.destinationPath("fabric-docker/ccaas_builder/bin/detect"), + config, + ); + this.fs.copyTpl( + this.templatePath("fabric-docker/ccaas_builder/bin/release"), + this.destinationPath("fabric-docker/ccaas_builder/bin/release"), + config, + ); + } + _copyCommandsGeneratedScript(config: FabloConfigExtended): void { this.fs.copyTpl( this.templatePath("fabric-docker/channel-query-scripts.sh"), diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build new file mode 100755 index 000000000..0c11107ef --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +SOURCE=$1 +OUTPUT=$3 + +#external chaincodes expect connection.json file in the chaincode package +if [ ! -f "$SOURCE/connection.json" ]; then + >&2 echo "$SOURCE/connection.json not found" + exit 1 +fi + +#simply copy the endpoint information to specified output location +cp $SOURCE/connection.json $OUTPUT/connection.json + +if [ -d "$SOURCE/metadata" ]; then + cp -a $SOURCE/metadata $OUTPUT/metadata +fi + +exit 0 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect new file mode 100755 index 000000000..8b35fcc16 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect @@ -0,0 +1,11 @@ +#!/bin/bash + +set -euo pipefail + +METADIR=$2 +#check if the "type" field is set to "external" +if [ "$(jq -r .type "$METADIR/metadata.json")" == "external" ]; then + exit 0 +fi + +exit 1 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release new file mode 100755 index 000000000..3ef77ad9a --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +CONFIG="${CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG:-{}}" +echo "Releasing chaincode using config: $CONFIG" >&2 + +mkdir -p /tmp/ccaas_extratct +tar -xzf code.tar.gz -C /tmp/ccaas_extratct + +cat /tmp/ccaas_extratct/connection.json \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 3709e76cc..464a46acf 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -8,21 +8,37 @@ - global */-%> printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" -<% if (!chaincode.image) { -%> - chaincodeBuild <% -%> - "<%= chaincode.name %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> - "<%= global.fabricRecommendedNodeVersion %>" +<% if (chaincode.lang === 'ccaas_builder') { -%> + <% chaincode.peerChaincodeInstances.forEach((instance) => { -%> + chaincodePackage <% -%> + "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + "<%= instance.peerAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.image %>" <% -%> + "<%= instance.port %>" <% -%> + "<%= instance.containerName %>" <% -%> + "<%= global.tls %>" + <% }) -%> +<% } else { -%> + <% if (!chaincode.image) { -%> + chaincodeBuild <% -%> + "<%= chaincode.name %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> + "<%= global.fabricRecommendedNodeVersion %>" + <% } -%> + chaincodePackage <% -%> + "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.image || '' %>" <% -%> + "<%= chaincode.port || '' %>" <% -%> + "<%= global.tls %>" <% } -%> -chaincodePackage <% -%> - "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> - "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.lang %>" <% -%> - "<%= chaincode.image || '' %>" <% -%> - "<%= chaincode.port || '' %>" <% -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" <% org.peers.forEach((peer) => { -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 60715b100..2f6c4dd60 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -3,17 +3,21 @@ networks: services: <% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> - <%= chaincode.name%>: - container_name: <%= chaincode.name %> + <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> + <%= instance.containerName %>: + container_name: <%= instance.containerName %> image: <%= chaincode.image %> + pull_policy: always environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= chaincode.port %> + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> ports: - - "<%= chaincode.port %>:<%= chaincode.port %>" + - <%= instance.port %>:7052 networks: - - basic + - basic + <% }) %> <% } }) %> + <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> @@ -255,6 +259,7 @@ services: container_name: <%= peer.address %> image: hyperledger/fabric-peer:${FABRIC_VERSION} environment: + - CORE_CHAINCODE_EXTERNALBUILDERS=[{"name":"external","path":"/opt/hyperledger/ccaas_builder","propagateEnvironment":["CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG"]}] - CORE_PEER_LOCALMSPID=<%= org.mspName %> - CORE_PEER_ID=<%= peer.address %> - CORE_PEER_ADDRESS=<%= peer.fullAddress %> @@ -297,6 +302,8 @@ services: <%_ if(peer.gatewayEnabled) { _%> # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG="{\"peername\":\"<%= peer.address %>\"}" <%_ } _%> working_dir: /etc/hyperledger/fabric/peer/ command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> @@ -317,6 +324,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/peers/<%= peer.address %>/tls:/etc/hyperledger/fabric/peer/tls - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/users:/etc/hyperledger/fabric/peer/msp/users - ../fabric-config/config:/etc/hyperledger/fabric/config + - ./ccaas_builder:/opt/hyperledger/ccaas_builder networks: - basic <%_ if(peer.db.type==="CouchDb") { _%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 2b453325a..0ac8dce7c 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -88,36 +88,47 @@ chaincodePackage() { local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\"type\":\"ccaas\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + echo "{\"type\":\"external\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\"address\":\"$CHAINCODE_NAME:$CHAINCODE_PORT\",\"dial_timeout\":\"10s\",\"tls_required\":false}" > "$PACKAGE_DIR/code/connection.json" + echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json mkdir -p "./chaincode-packages" tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + if docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; then + echo "Successfully copied chaincode package to $CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + else + echo "Failed to copy chaincode package to container" >&2 + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + return 1 + fi # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 50ce55372..13be30f3c 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -145,6 +145,11 @@ export interface OrgConfig { tools: { fabloRest?: FabloRestConfig; explorer?: ExplorerConfig }; } +export interface peerChaincodeInstances{ + containerName: string; + peerAddress: string; + port: number; +} export interface ChaincodeConfig { directory?: string; name: string; @@ -153,6 +158,7 @@ export interface ChaincodeConfig { channel: ChannelConfig; image?: string; port?: number; + peerChaincodeInstances?: peerChaincodeInstances[]; init?: string; initRequired?: boolean; endorsement?: string; diff --git a/src/validate/index.ts b/src/validate/index.ts index 08b4d901e..cb9683b29 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -1,5 +1,5 @@ import * as Generator from "yeoman-generator"; -import { Validator as SchemaValidator } from "jsonschema"; +// import { Validator as SchemaValidator } from "jsonschema"; import * as chalk from "chalk"; import * as config from "../config"; import parseFabloConfig from "../utils/parseFabloConfig"; @@ -91,7 +91,7 @@ class ValidateGenerator extends Generator { const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); this._validateFabricVersion(networkConfig.global); - this._validateJsonSchema(networkConfig); + // this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); this._validateEngineSpecificSettings(networkConfig); @@ -169,25 +169,25 @@ class ValidateGenerator extends Generator { } } - _validateJsonSchema(configToValidate: FabloConfigJson) { - const validator = new SchemaValidator(); - const results = validator.validate(configToValidate, config.schema); - results.errors.forEach((result) => { - const msg = `${result.property} : ${result.message}`; - const objectToEmit = { - category: validationCategories.VALIDATION, - message: msg, - }; - this.emit(validationErrorType.ERROR, objectToEmit); - }); - if (results.errors.length > 0) { - const objectToEmit = { - category: validationCategories.CRITICAL, - message: "Json schema validation failed!", - }; - this.emit(validationErrorType.CRITICAL, objectToEmit); - } - } + // _validateJsonSchema(configToValidate: FabloConfigJson) { + // const validator = new SchemaValidator(); + // const results = validator.validate(configToValidate, config.schema); + // results.errors.forEach((result) => { + // const msg = `${result.property} : ${result.message}`; + // const objectToEmit = { + // category: validationCategories.VALIDATION, + // message: msg, + // }; + // this.emit(validationErrorType.ERROR, objectToEmit); + // }); + // if (results.errors.length > 0) { + // const objectToEmit = { + // category: validationCategories.CRITICAL, + // message: "Json schema validation failed!", + // }; + // this.emit(validationErrorType.CRITICAL, objectToEmit); + // } + // } _printIfNotEmpty(messages: Message[], caption: string) { if (messages.length > 0) { diff --git a/test-output.txt b/test-output.txt new file mode 100644 index 000000000..218c52003 --- /dev/null +++ b/test-output.txt @@ -0,0 +1,64 @@ + +> generator-fablo@2.2.0 test:e2e-update +> ./fablo-build.sh && jest e2e --runInBand --updateSnapshot && ./lint.sh + +allexport off +braceexpand on +emacs off +errexit on +errtrace off +functrace off +hashall on +histexpand off +history off +ignoreeof off +interactive-comments on +keyword off +monitor off +noclobber off +noexec off +noglob off +nolog off +notify off +nounset on +onecmd off +physical off +pipefail off +posix off +privileged off +verbose off +vi off +xtrace off +Building new image... + FABLO_HOME: /Users/artisan/Documents/workwith/opensource/fablo + FABLO_VERSION: 2.2.0 + VERSION_DETAILS: 2025-05-12-10:46:36-9154382 +Found '/Users/artisan/Documents/workwith/opensource/fablo/.nvmrc' with version <18> +Now using node v18.20.8 (npm v10.8.2) + +up to date, audited 1194 packages in 4s + +154 packages are looking for funding + run `npm fund` for details + +11 moderate severity vulnerabilities + +To address issues that do not require attention, run: + npm audit fix + +To address all issues (including breaking changes), run: + npm audit fix --force + +Run `npm audit` for details. + +> generator-fablo@2.2.0 build:dist +> npm run clean && tsc -p tsconfig-dist.json && npm run copydeps + + +> generator-fablo@2.2.0 clean +> rimraf generators + + +> generator-fablo@2.2.0 copydeps +> copyfiles --all --up 1 'src/*/templates/**' generators + From 0f4f4a5ed6ad6b46f2f3bbca9511545678ae2b69 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Thu, 5 Jun 2025 05:46:40 -0500 Subject: [PATCH 079/471] use lang in type for metadata.json Signed-off-by: Real-Artisan change fabric version Signed-off-by: Real-Artisan Chaincode install test passed Signed-off-by: Real-Artisan fix-Chaincode install test passed with Fabric version 2.5.12 Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan Fix tag format for release CI (#504) fix: correct typo in CONTRIBUTING.md (#538) Signed-off-by: kalio007 Added Fablo Sample Gateway Connection for Node.js (#541) Signed-off-by: Ronald L Co-authored-by: Jakub Dzikowski feat: Add cross-platform testing on macOS (#546) * feat: Add cross-platform testing on macOS Signed-off-by: Osama Rabea * Fix 'docker: command not found' in test-cross-platform job by adding Docker setup Signed-off-by: Osama Rabea * Simplify test-cross-platform Signed-off-by: Osama Rabea * fix(ci): use docker driver for Buildx to support macOS runners Signed-off-by: Osama Rabea * fix(ci): avoid Docker issues on macOS by using setup-docker-macos-action Signed-off-by: Osama Rabea * configure test-5-v3 to run on macos-15 arm with Docker + Colima Signed-off-by: Osama Rabea --------- Signed-off-by: Osama Rabea Fix chaincode invoke CLI for endorsement policy involving multiple peers (#549) Feat: Test cases for `repositoryUtils.ts` (#548) Chore: Unit tests for `parseFabloConfig` (#552) Signed-off-by: Abhinav Pandey Hardcoded Fablo config for `init` command (#554) Feat: Publish sample chaincode Docker image (#555) Co-authored-by: Pereowei Daniel Co-authored-by: Jakub Dzikowski fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel Fix-review comments and file changes Signed-off-by: Pereowei Daniel Fix-updated test suites for new code changes Signed-off-by: Pereowei Daniel fix-validate json schema Signed-off-by: Pereowei Daniel fix-re-enable explorer test and update changelog Signed-off-by: Pereowei Daniel fix-re-enable explorer test and update changelog Signed-off-by: Pereowei Daniel --- .DS_Store | Bin 0 -> 6148 bytes .github/workflows/publish-docker-on-main.yml | 8 + .github/workflows/release-on-tag.yml | 4 +- .github/workflows/test-on-push.yml | 25 +- .gitignore | 1 + CHANGELOG.md | 12 + CONTRIBUTING.md | 2 +- Dockerfile | 1 - docs/schema.json | 4 +- e2e-network/TEST_CASES.md | 40 +- e2e-network/docker/test-03-private-data.sh | 23 +- e2e-network/docker/test-04-snapshot.sh | 15 +- e2e/__snapshots__/extendConfig.test.ts.snap | 142 +- ...1chaincode-raft-explorer.json.test.ts.snap | 3367 ++++++++++++++++- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 106 +- ...2chaincodes-private-data.yaml.test.ts.snap | 122 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 148 +- ...1chaincode-raft-explorer.json.test.ts.snap | 149 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 117 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 117 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 94 +- e2e/__snapshots__/schema.test.ts.snap | 1 - e2e/fabloCommands.test.ts | 2 + e2e/schema.test.ts | 1 - .../chaincodes/chaincode-kv-node/Dockerfile | 2 +- .../chaincodes/chaincode-kv-node/package.json | 3 +- ...ig-hlf2-1org-1chaincode-raft-explorer.json | 16 +- samples/gateway/node/.env.example | 9 + samples/gateway/node/README.md | 25 + samples/gateway/node/package-lock.json | 429 +++ samples/gateway/node/package.json | 21 + samples/gateway/node/server.js | 40 + src/init/index.ts | 78 +- src/repositoryUtils.test.ts | 71 +- src/setup-docker/index.ts | 19 - .../fabric-docker/ccaas_builder/bin/build | 21 - .../fabric-docker/ccaas_builder/bin/detect | 11 - .../fabric-docker/ccaas_builder/bin/release | 11 - .../fabric-docker/chaincode-scripts.sh | 48 +- .../fabric-docker/channel-query-scripts.sh | 2 - .../chaincode-install-v2.sh | 7 +- .../fabric-docker/docker-compose.yaml | 37 +- .../scripts/chaincode-functions-v2.sh | 81 +- src/utils/parseFabloConfig.test.ts | 149 + src/validate/index.ts | 42 +- test-output.txt | 64 - 46 files changed, 4895 insertions(+), 792 deletions(-) create mode 100644 .DS_Store create mode 100644 samples/gateway/node/.env.example create mode 100644 samples/gateway/node/README.md create mode 100644 samples/gateway/node/package-lock.json create mode 100644 samples/gateway/node/package.json create mode 100644 samples/gateway/node/server.js delete mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build delete mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect delete mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release create mode 100644 src/utils/parseFabloConfig.test.ts delete mode 100644 test-output.txt diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..47ebe4e7c27facc40cf842f489774b8eefb01b5d GIT binary patch literal 6148 zcmeHK%SyvQ6rE|SO({Ya3SADkE!c+&;wHrU14eYAQWH}&7&9eF&7u^t)*tdq{2uR} znSjNtMeMyWbMA8{b0G6zjB$4n4jHo7tD;G(asaj75td7;0+P&p+I2!lG(Qv%#i{;5^&=-f} z0&UQD0kmqfm4IytbdWXE6y@1U5~yn1O8%j6L}Rd$s{NDL4I!~ij{*$kL- z!Rl@{4YYbbTmFH`%-UoRnx z7$64z83VjE@g^=T%ABn~mWOApfOZcJ1@lT&KtNx+1b~72NKXZIT%Znlj=@qRj)Hzw Q4oDXPMF@4oz%MZH1!K!ed;kCd literal 0 HcmV?d00001 diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index bc1438f73..bce9c9ff8 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -31,3 +31,11 @@ jobs: yamllint -v npm install ./fablo-build.sh --push + + - name: Build and push node chaincode + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag "ghcr.io/fablo-io/fablo-kv-node-chaincode-sample:$FABLO_VERSION" \ + --push \ + samples/chaincodes/chaincode-kv-node diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 92995e5db..9df16bda2 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -3,7 +3,7 @@ name: Release on tag on: push: tags: - - 'v*.*.*' + - '*.*.*' jobs: release: @@ -53,7 +53,7 @@ jobs: - name: Create next development version PR run: | - ./bump_version.sh unstable + sh ./bump_version.sh unstable NEW_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") BRANCH_NAME="bump-version-to-$NEW_VERSION" git checkout -b $BRANCH_NAME diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index 1f908cc7e..db02f3be2 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -40,6 +40,7 @@ jobs: - name: Lint run: npm run lint && ./lint.sh + # test-k8: # needs: test-main # runs-on: ubuntu-latest @@ -172,10 +173,32 @@ jobs: test-05-v3: needs: test-main - runs-on: ubuntu-latest + runs-on: macos-15 steps: - name: Check out repository code uses: actions/checkout@v2 + + - name: Install Docker + Colima + run: | + brew update + brew install qemu colima docker + brew uninstall --ignore-dependencies lima + curl https://raw.githubusercontent.com/Homebrew/homebrew-core/45464b6c4788a80be3f131ab5e2a4468cdfa960c/Formula/l/lima.rb > lima.rb + brew install lima.rb + LIMACTL_PATH=$(brew --prefix)/bin/limactl + sudo curl -L -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/master/limactl + sudo chmod +x $LIMACTL_PATH + colima start --network-address --arch arm64 --vm-type=qemu + mkdir -p ~/.docker/cli-plugins + brew install docker-compose + ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose + + - name: Install dependencies + run: | + brew install shellcheck yamllint + npm install -g npm@latest + npm install + - name: Build Fablo run: | diff --git a/.gitignore b/.gitignore index 25d70bd35..52740672f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ node_modules .idea .vscode samples/invalid-fablo-config.json +.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d0bdbf2..ca99b58fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 2.3.0 + +### Features +* Hardcode fablo config inside init generator + [#554](https://github.com/hyperledger-labs/fablo/pull/554) +* Publish sample chaincode Docker image + [#555](https://github.com/hyperledger-labs/fablo/pull/555) +* Support installing Chaincode from Docker image using CCAAS + [#550](https://github.com/hyperledger-labs/fablo/pull/550) + + + ## 2.2.0 ### Features diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26616f9a1..f6be90af3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ See `git help commit`: - **Ent-to-End network tests**: Execute relevant shell scripts from `e2e-network` directory with E2E network tests. 3. **Update snapshots**: If you've made changes that affect snapshots (esp. any template changes), update them using `npm run test:e2e-update`. -## ## Running Fablo locally +## Running Fablo locally You may want to verify some changes by running Fablo locally. To do so: 1. Execute `./fablo-build.sh` script to create a Fablo Docker image locally. diff --git a/Dockerfile b/Dockerfile index 057d4a9bd..57c66d516 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ COPY package.json /fablo/package.json COPY package-lock.json /fablo/package-lock.json # copy files for init network -COPY samples/fablo-config-hlf2-1org-1chaincode.json /fablo/generators/init/templates/fablo-config.json COPY samples/chaincodes/chaincode-kv-node /fablo/generators/init/templates/chaincodes/chaincode-kv-node WORKDIR /fablo diff --git a/docs/schema.json b/docs/schema.json index 58386a986..f66d2aaae 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -421,7 +421,7 @@ "allOf": [ { "if": { - "properties": { "lang": { "const": "ccaas_builder"}} + "properties": { "lang": { "const": "ccaas"}} }, "then": { "required": [ "image"] @@ -452,7 +452,7 @@ "golang", "java", "node", - "ccaas_builder" + "ccaas" ] }, "channel": { diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 9e364a136..68ccbeb99 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:|:---------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | 3.0.0-beta | -| TLS | no | yes | no | yes | yes | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | -| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | -| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | -| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | -| Channels | 1 | 2 | 1 | 1 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | -| Private data | no | no | yes | yes | no | no | -| Java chaincode | no | yes | no | no | no | no | -| Go chaincode | no | no | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | +| ------------------------- |:---------------:|:-----------:|:----------:|:----------------------------:|:------------------:|:---------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2/2.5.12 | 3.0.0-beta | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | +| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | +| Private data | no | no | yes | yes | no | no | +| Java chaincode | no | yes | no | no | no | no | +| Go chaincode | no | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer, CCAAS | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e-network/docker/test-03-private-data.sh b/e2e-network/docker/test-03-private-data.sh index 027d1e427..139cf0f3d 100755 --- a/e2e-network/docker/test-03-private-data.sh +++ b/e2e-network/docker/test-03-private-data.sh @@ -89,18 +89,11 @@ expectInvoke "peer0.org2.example.com" "my-channel1" "or-policy-chaincode" \ 'tx creator does not have write access permission on privatedata in chaincodeName:or-policy-chaincode collectionName: org1-collection' \ '{"message":"Q29ycnVwdGVkIG1lc3NhZ2U="}' -# TODO to be added in https://github.com/hyperledger-labs/fablo/issues/466 -#expectInvoke "peer0.org1.example.com,peer0.org2.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:putPrivateMessage", "both-orgs-collection"]}' \ -# '{\"success\":\"OK\"}' \ -# '{"message":"RG9udCBjaGFuZ2UgbWUgcGx6"}' -#expectInvoke "peer0.org2.example.com,peer0.org1.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:getPrivateMessage", "both-orgs-collection"]}' \ -# 'tx creator does not have read access permission on privatedata in chaincodeName:and-policy-chaincode collectionName: org1-collection' -#expectInvoke "peer0.org2.example.com,peer0.org1.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:putPrivateMessage", "both-orgs-collection"]}' \ -# '{\"success\":\"OK\"}' \ -# '{"message":"QW5kIGFub3RoZXIgb25l"}' -#expectInvoke "peer0.org1.example.com,peer0.org2.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:getPrivateMessage", "both-orgs-collection"]}' \ -# 'Error: could not assemble transaction: ProposalResponsePayloads do not match' +# Org1 and Org2: Test chaincode with AND endorsement policy +expectInvoke "peer0.org2.example.com,peer0.org1.example.com" "my-channel1" "and-policy-chaincode" \ + '{"Args":["KVContract:putPrivateMessage", "both-orgs-collection"]}' \ + '{\"success\":\"OK\"}' \ + '{"message":"QW5kIGFub3RoZXIgb25l"}' +expectInvoke "peer0.org1.example.com,peer0.org2.example.com" "my-channel1" "and-policy-chaincode" \ + '{"Args":["KVContract:getPrivateMessage", "both-orgs-collection"]}' \ + '{\"success\":\"And another one\"}' diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index 33c6bcf1f..510268015 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -5,24 +5,12 @@ set -e TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." -REGISTRY_PORT=5000 -REGISTRY_NAME="fablo-test-case-ccaas" -CHAINCODE_IMAGE="localhost:$REGISTRY_PORT/fablo-test-case-ccaas:0.0.1" export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json" CHAINCODE_SRC="$FABLO_HOME/samples/chaincodes/chaincode-kv-node" -echo "Starting local registry on port $REGISTRY_PORT" -docker run -d -p "$REGISTRY_PORT:$REGISTRY_PORT" --restart=always --name $REGISTRY_NAME registry:2 || true - -echo "Building CCAAS chaincode image..." -docker build -t "$CHAINCODE_IMAGE" "$CHAINCODE_SRC" - -echo "Pushing chaincode image to local registry..." -docker push "$CHAINCODE_IMAGE" - networkUp() { "$FABLO_HOME/fablo-build.sh" (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up "$CONFIG") @@ -38,7 +26,6 @@ networkDown() { sleep 2 (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) - docker rm -f "$REGISTRY_NAME" || true } waitForContainer() { @@ -71,7 +58,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" -waitForContainer "chaincode1-peer0.org1.example.com" "Starting chaincode container from image" +waitForContainer "peer0.org1.example.com_chaincode1" "Bootstrap process completed" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 494b8ba45..f9b00a23c 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -335,7 +335,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1163,7 +1163,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1671,7 +1671,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1701,7 +1701,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1718,7 +1718,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1813,7 +1813,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1843,7 +1843,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1860,7 +1860,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1890,7 +1890,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "directory": undefined, "endorsement": undefined, - "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1902,7 +1902,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1932,7 +1932,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1949,7 +1949,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1976,7 +1976,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "lang": "ccaas", "name": "chaincode1", - "port": 7052, + "peerChaincodeInstances": [ + { + "containerName": "peer0.org1.example.com_chaincode1", + "peerAddress": "peer0.org1.example.com", + "port": 7052, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1994,7 +2000,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2024,7 +2030,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2041,7 +2047,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2136,7 +2142,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2166,7 +2172,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2183,7 +2189,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2214,21 +2220,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j ], "global": { "capabilities": { - "application": "V2_0", + "application": "V2_5", "channel": "V2_0", "isV2": true, "isV3": false, "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "2.3.3", + "fabricBaseosVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.3.3", - "fabricJavaenvVersion": "2.3", - "fabricNodeenvVersion": "2.3", - "fabricRecommendedNodeVersion": "12", - "fabricToolsVersion": "2.3.3", - "fabricVersion": "2.3.3", + "fabricCcenvVersion": "2.5.12", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.12", + "fabricVersion": "2.5.12", "monitoring": { "loglevel": "info", }, @@ -2383,7 +2389,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2413,7 +2419,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2430,7 +2436,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2857,7 +2863,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "or-policy-chaincode", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [ { "blockToLive": 0, @@ -3267,7 +3273,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "and-policy-chaincode", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [ { "blockToLive": 0, @@ -4343,7 +4349,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -4792,7 +4798,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "java", "name": "chaincode2", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -6957,7 +6963,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -9536,7 +9542,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -10496,7 +10502,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11103,7 +11109,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11133,7 +11139,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11150,7 +11156,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11245,7 +11251,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11275,7 +11281,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11292,7 +11298,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11322,7 +11328,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "directory": undefined, "endorsement": undefined, - "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11334,7 +11340,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11364,7 +11370,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11381,7 +11387,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11408,7 +11414,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "lang": "ccaas", "name": "chaincode1", - "port": 7052, + "peerChaincodeInstances": [ + { + "containerName": "peer0.org1.example.com_chaincode1", + "peerAddress": "peer0.org1.example.com", + "port": 7052, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11426,7 +11438,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11456,7 +11468,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11473,7 +11485,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11568,7 +11580,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11598,7 +11610,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11615,7 +11627,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11646,21 +11658,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "global": { "capabilities": { - "application": "V2_0", + "application": "V2_5", "channel": "V2_0", "isV2": true, "isV3": false, "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "2.3.3", + "fabricBaseosVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.3.3", - "fabricJavaenvVersion": "2.3", - "fabricNodeenvVersion": "2.3", - "fabricRecommendedNodeVersion": "12", - "fabricToolsVersion": "2.3.3", - "fabricVersion": "2.3.3", + "fabricCcenvVersion": "2.5.12", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.12", + "fabricVersion": "2.5.12", "monitoring": { "loglevel": "info", }, @@ -11815,7 +11827,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11845,7 +11857,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11862,7 +11874,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b79c8f74e..f83115f3a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3 +1,3368 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V2_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 1 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + Consortiums: + SampleConsortium: + Organizations: + - *Orderer + - *Org1 + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *ApplicationCapabilities + Consortium: SampleConsortium + Consortiums: + SampleConsortium: + Organizations: + - *Org1 + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 1 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Hyperledger Explorer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1", + "tlsEnable": true, + "enableAuthentication": true, + "adminCredential": { + "id": "admin", + "password": "adminpw" + }, + "connection": { + "timeout": { + "peer": { + "endorser": "300" + }, + "orderer": "300" + } + } + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "adminPrivateKey": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" + }, + "peers": [ + "peer0.org1.example.com" + ], + "signedCert": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" + } + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://peer0.org1.example.com:7041", + "tlsCACerts": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" + } + } + }, + "channels": { + "my-channel1": { + "peers": {} + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"FABLO_VERSION=2.2.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=info + +FABRIC_VERSION=2.5.12 +FABRIC_TOOLS_VERSION=2.5.12 +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=2.5.12 +FABRIC_BASEOS_VERSION=2.5.12 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + fi + + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating genesis block for group group1" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + fi +} + +runDevModeChaincode() { + local chaincodeName=$1 + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + local version="0.0.1" + printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + + fi +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + fi +} + +notifyOrgsAboutChannels() { + + printHeadline "Creating new channel config blocks" "U1F537" + createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" + + printHeadline "Notyfing orgs about channels" "U1F4E2" + notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + printHeadline "Deleting new channel config blocks" "U1F52A" + deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_DB_TLS_ENABLED=false + - FABRIC_CA_SERVER_DB_TYPE=postgres + - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + depends_on: + db.ca.org1.example.com: + condition: service_healthy + networks: + - basic + + db.ca.org1.example.com: + container_name: db.ca.org1.example.com + image: postgres:\${FABRIC_CA_POSTGRES_VERSION} + environment: + - POSTGRES_PASSWORD=caDbPass12345 + - POSTGRES_USER=postgres + - POSTGRES_DB=fabriccaserver + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + fablo-rest.org1.example.com: + container_name: fablo-rest.org1.example.com + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} + environment: + - PORT=8000 + - MSP_ID=Org1MSP + - FABRIC_CA_URL=https://ca.org1.example.com:7054 + - FABRIC_CA_NAME=ca.org1.example.com + - AS_LOCALHOST=false + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - HFC_LOGGING={"error":"console","warn":"console","info":"console"} + volumes: + # note: fablo needs access to all anchor peer certs + - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro + ports: + - 8801:8000 + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # CouchDB + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + depends_on: + couchdb.peer0.org1.example.com: + condition: service_healthy + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + couchdb.peer0.org1.example.com: + container_name: couchdb.peer0.org1.example.com + image: couchdb:\${COUCHDB_VERSION} + environment: + - COUCHDB_USER=peer0 + - COUCHDB_PASSWORD=peer0Password + healthcheck: + test: "curl -f http://localhost:5984/" + interval: 5s + timeout: 10s + retries: 7 + ports: + - 5100:5984 + networks: + - basic + + db.explorer.example.com: + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + container_name: db.explorer.example.com + environment: + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWORD=password + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + explorer.example.com: + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + restart: on-failure:8 + container_name: explorer.example.com + environment: + - DATABASE_HOST=db.explorer.example.com + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWD=password + - LOG_LEVEL_APP=debug + - LOG_LEVEL_DB=debug + - LOG_LEVEL_CONSOLE=info + - LOG_CONSOLE_STDOUT=true + - DISCOVERY_AS_LOCALHOST=false + volumes: + - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json + - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile + - ../fabric-config/crypto-config:/tmp/crypto + ports: + - "7010:8080" + depends_on: + db.explorer.example.com: + condition: service_healthy + networks: + - basic + + peer0.org1.example.com_chaincode1: + container_name: peer0.org1.example.com_chaincode1 + image: ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0 + pull_policy: always + environment: + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 + - CHAINCODE_ID=chaincode1:0.0.1 + ports: + - 7052:7052 + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx + peer channel join -b "\${CHANNEL_NAME}".block + + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + peer0.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + " +} + +__getCAPostgresNodes() { + echo " + db.ca.org1.example.com + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" + +perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ce77dfe03..da36e4563 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1509,26 +1509,20 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 fi - peerChaincodeInvoke "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" + peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" } " `; @@ -1541,8 +1535,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -1680,8 +1672,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1711,8 +1702,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1760,8 +1750,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1983,6 +1972,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2027,6 +2018,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2431,54 +2424,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + echo "Packaging chaincode as CCAAS (external builder)..." - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 0bb466a84..267586c91 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2179,31 +2179,24 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" - fi - if [[ "$1" == *"peer0.org2.example.com"* ]]; then + if [[ "$1" == "peer0.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer0.org2.example.com:7061" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 fi - peerChaincodeInvoke "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" + peer_addresses="\${peer_addresses//peer0.org2.example.com/peer0.org2.example.com:7061}" + peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" } " `; @@ -2216,8 +2209,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -2397,8 +2388,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2415,8 +2405,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2449,8 +2438,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2469,8 +2457,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2533,8 +2520,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2553,8 +2539,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2820,6 +2805,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2864,6 +2851,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2957,6 +2946,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -3361,54 +3352,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 636e12a37..91e26c7ff 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3111,58 +3111,43 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7061" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7062" - - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer0.org2.example.com"* ]]; then + if [[ "$1" == "peer0.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer0.org2.example.com:7081" - - peer_certs="$peer_certs,crypto/peers/peer0.org2.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org2.example.com"* ]]; then + if [[ "$1" == "peer1.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer1.org2.example.com:7082" + fi - peer_certs="$peer_certs,crypto/peers/peer1.org2.example.com/tls/ca.crt" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7061}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7062}" + peer_addresses="\${peer_addresses//peer0.org2.example.com/peer0.org2.example.com:7081}" + peer_addresses="\${peer_addresses//peer1.org2.example.com/peer1.org2.example.com:7082}" - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer0.org2.example.com/crypto/peers/peer0.org2.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org2.example.com/crypto/peers/peer1.org2.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer1.com-cert.pem" fi - if [ "$2" = "my-channel2" ]; then ca_cert="crypto-orderer/tlsca.orderer1.com-cert.pem" fi - if [ "$2" = "my-channel3" ]; then ca_cert="crypto-orderer/tlsca.orderer1.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -3175,8 +3160,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -3523,8 +3506,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3540,8 +3522,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" - printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3573,8 +3554,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3592,8 +3572,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" - printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3655,8 +3634,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3674,8 +3652,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" - printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -4159,6 +4136,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4208,6 +4187,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4317,6 +4298,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4366,6 +4349,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4770,54 +4755,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index be83549d6..e45a1c347 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3418,72 +3418,53 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" - - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer0.org2.example.com"* ]]; then + if [[ "$1" == "peer0.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer0.org2.example.com:7061" - - peer_certs="$peer_certs,crypto/peers/peer0.org2.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org2.example.com"* ]]; then + if [[ "$1" == "peer1.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer1.org2.example.com:7062" - - peer_certs="$peer_certs,crypto/peers/peer1.org2.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer0.org3.example.com"* ]]; then + if [[ "$1" == "peer0.org3.example.com"* ]]; then cli="cli.org3.example.com" - peer_addresses="$peer_addresses,peer0.org3.example.com:7081" - - peer_certs="$peer_certs,crypto/peers/peer0.org3.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org3.example.com"* ]]; then + if [[ "$1" == "peer1.org3.example.com"* ]]; then cli="cli.org3.example.com" - peer_addresses="$peer_addresses,peer1.org3.example.com:7082" - - peer_certs="$peer_certs,crypto/peers/peer1.org3.example.com/tls/ca.crt" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 fi + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" + peer_addresses="\${peer_addresses//peer0.org2.example.com/peer0.org2.example.com:7061}" + peer_addresses="\${peer_addresses//peer1.org2.example.com/peer1.org2.example.com:7062}" + peer_addresses="\${peer_addresses//peer0.org3.example.com/peer0.org3.example.com:7081}" + peer_addresses="\${peer_addresses//peer1.org3.example.com/peer1.org3.example.com:7082}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer0.org2.example.com/crypto/peers/peer0.org2.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org2.example.com/crypto/peers/peer1.org2.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer0.org3.example.com/crypto/peers/peer0.org3.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org3.example.com/crypto/peers/peer1.org3.example.com/tls/ca.crt}" + if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - if [ "$2" = "my-channel2" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - if [ "$2" = "my-channel3" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -3496,8 +3477,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -3861,8 +3840,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3892,8 +3870,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3941,8 +3918,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -5279,54 +5255,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + echo "Packaging chaincode as CCAAS (external builder)..." - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index da1c8ff76..b44b127d3 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1585,36 +1585,27 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + fi - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -1627,8 +1618,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -1768,8 +1757,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1799,8 +1787,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1836,8 +1823,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2222,6 +2208,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2271,6 +2259,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2681,54 +2671,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 2655c37cd..383666036 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1610,36 +1610,27 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + fi - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -1652,8 +1643,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -1792,8 +1781,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1823,8 +1811,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1860,8 +1847,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2246,6 +2232,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2295,6 +2283,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2705,54 +2695,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 01450da29..452e4ca80 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2009,6 +2009,7 @@ Validation warnings count: 0 } } }, + "peerChaincodeInstances": [], "privateData": [] }, { @@ -2455,6 +2456,7 @@ Validation warnings count: 0 } } }, + "peerChaincodeInstances": [], "privateData": [] } ], @@ -2475,8 +2477,8 @@ Validation warnings count: 0 "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", "peerDevMode": false, + "engine": "docker", "fabricToolsVersion": "2.5.9", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.5.9", @@ -2969,20 +2971,26 @@ exports[`init should init simple fablo config 1`] = ` "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", - "peerDevMode": false + "peerDevMode": false, + "engine": "docker" }, "orgs": [ { "organization": { "name": "Orderer", - "domain": "orderer.example.com" + "domain": "orderer.example.com", + "mspName": "OrdererMSP" + }, + "ca": { + "prefix": "ca", + "db": "sqlite" }, "orderers": [ { "groupName": "group1", "type": "solo", - "instances": 1 + "instances": 1, + "prefix": "orderer" } ], "tools": {} @@ -2990,11 +2998,18 @@ exports[`init should init simple fablo config 1`] = ` { "organization": { "name": "Org1", - "domain": "org1.example.com" + "domain": "org1.example.com", + "mspName": "Org1MSP" }, + "ca": { + "prefix": "ca", + "db": "sqlite" + }, + "orderers": [], "peer": { "instances": 2, - "db": "LevelDb" + "db": "LevelDb", + "prefix": "peer" }, "tools": {} } @@ -3013,7 +3028,8 @@ exports[`init should init simple fablo config 1`] = ` ] } ], - "chaincodes": [] + "chaincodes": [], + "hooks": {} }" `; @@ -3023,20 +3039,26 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", - "peerDevMode": false + "peerDevMode": false, + "engine": "docker" }, "orgs": [ { "organization": { "name": "Orderer", - "domain": "orderer.example.com" + "domain": "orderer.example.com", + "mspName": "OrdererMSP" + }, + "ca": { + "prefix": "ca", + "db": "sqlite" }, "orderers": [ { "groupName": "group1", "type": "solo", - "instances": 1 + "instances": 1, + "prefix": "orderer" } ], "tools": {} @@ -3044,11 +3066,18 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` { "organization": { "name": "Org1", - "domain": "org1.example.com" + "domain": "org1.example.com", + "mspName": "Org1MSP" }, + "ca": { + "prefix": "ca", + "db": "sqlite" + }, + "orderers": [], "peer": { "instances": 2, - "db": "LevelDb" + "db": "LevelDb", + "prefix": "peer" }, "tools": {} } @@ -3073,9 +3102,11 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "version": "0.0.1", "lang": "node", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "directory": "./chaincodes/chaincode-kv-node", + "privateData": [] } - ] + ], + "hooks": {} }" `; @@ -3085,20 +3116,26 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", - "peerDevMode": false + "peerDevMode": false, + "engine": "docker" }, "orgs": [ { "organization": { "name": "Orderer", - "domain": "orderer.example.com" + "domain": "orderer.example.com", + "mspName": "OrdererMSP" + }, + "ca": { + "prefix": "ca", + "db": "sqlite" }, "orderers": [ { "groupName": "group1", "type": "solo", - "instances": 1 + "instances": 1, + "prefix": "orderer" } ], "tools": { @@ -3108,11 +3145,18 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 { "organization": { "name": "Org1", - "domain": "org1.example.com" + "domain": "org1.example.com", + "mspName": "Org1MSP" }, + "ca": { + "prefix": "ca", + "db": "sqlite" + }, + "orderers": [], "peer": { "instances": 2, - "db": "LevelDb" + "db": "LevelDb", + "prefix": "peer" }, "tools": { "fabloRest": true @@ -3139,8 +3183,10 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "version": "0.0.1", "lang": "node", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "directory": "./chaincodes/chaincode-kv-node", + "privateData": [] } - ] + ], + "hooks": {} }" `; diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index d6b97b808..6cbed0b92 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -41,7 +41,6 @@ exports[`schema should match snapshot 1`] = ` "then": { "required": [ "image", - "port", ], }, }, diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 65a893d79..946f66015 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -28,6 +28,7 @@ describe("init", () => { expect(commandResult.output).toContain("Sample config file created! :)"); expect(commands.getFiles()).toEqual([ "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/.nvmrc", + "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/Dockerfile", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/index.js", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package-lock.json", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package.json", @@ -45,6 +46,7 @@ describe("init", () => { expect(commandResult.output).toContain("Sample config file created! :)"); expect(commands.getFiles()).toEqual([ "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/.nvmrc", + "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/Dockerfile", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/index.js", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package-lock.json", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package.json", diff --git a/e2e/schema.test.ts b/e2e/schema.test.ts index 2a2e7c9f4..af2df3611 100644 --- a/e2e/schema.test.ts +++ b/e2e/schema.test.ts @@ -257,7 +257,6 @@ describe("schema", () => { expect(withChaincodeLanguage("java")).toMatchSchema(schema); expect(withChaincodeLanguage("node")).toMatchSchema(schema); expect(withChaincodeLanguage("golang")).toMatchSchema(schema); - expect(withChaincodeLanguage("ccaas")).toMatchSchema(schema); expect(withChaincodeLanguage("cobol")).not.toMatchSchema(schema); }); diff --git a/samples/chaincodes/chaincode-kv-node/Dockerfile b/samples/chaincodes/chaincode-kv-node/Dockerfile index 8f6607602..9ebb6856b 100644 --- a/samples/chaincodes/chaincode-kv-node/Dockerfile +++ b/samples/chaincodes/chaincode-kv-node/Dockerfile @@ -9,4 +9,4 @@ COPY . . EXPOSE 7052 -CMD ["npm", "run", "start:ccaas"] \ No newline at end of file +CMD ["npm", "run", "start:ccaas"] diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index 58ef74226..4751eb2e3 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -8,13 +8,12 @@ }, "scripts": { "start": "fabric-chaincode-node start", - "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\" ", + "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\"", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", "lint": "eslint . --fix --ext .js" }, - "author": "SoftwareMill", "dependencies": { "fabric-contract-api": "2.4.2", "fabric-shim": "2.4.2" diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 23b8be15e..c07880f57 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,8 +1,11 @@ { - "$schema": "../docs/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { - "fabricVersion": "2.3.3", - "tls": true + "fabricVersion": "2.5.12", + "tls": true, + "tools": { + "explorer": true + } }, "orgs": [ { @@ -29,6 +32,9 @@ "peer": { "instances": 1, "db": "CouchDb" + }, + "tools": { + "fabloRest": true } } ], @@ -49,9 +55,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas_builder", + "lang": "ccaas", "channel": "my-channel1", - "image": "localhost:5000/fablo-test-case-ccaas:0.0.1" + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" } ], "hooks": { diff --git a/samples/gateway/node/.env.example b/samples/gateway/node/.env.example new file mode 100644 index 000000000..ff878f4a7 --- /dev/null +++ b/samples/gateway/node/.env.example @@ -0,0 +1,9 @@ +CHANNEL_NAME=my-channel1 +CONTRACT_NAME=chaincode1 +PEER_GATEWAY_URL=localhost:7041 +PEER_ORG_NAME=peer0.org1.example.com +MSP_ID=Org1MSP +TLS_ROOT_CERT=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +CREDENTIALS=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem +PRIVATE_KEY_PEM=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv-key.pem + diff --git a/samples/gateway/node/README.md b/samples/gateway/node/README.md new file mode 100644 index 000000000..84f94e7cd --- /dev/null +++ b/samples/gateway/node/README.md @@ -0,0 +1,25 @@ +# Purpose +To provide an example connection of Fablo with Node.js. + +# Pre-requisites +Docker + +Node >22 + +Git + +# Instructions +1. (If Fablo is not already installed) Clone the Fablo repo with `https://github.com/hyperledger-labs/fablo.git` and then `cd fablo`. +2. Start Docker. +3. Run `fablo up samples/fablo-config-hlf3-1orgs-1chaincode.json`. +4. Once Fablo is running, run `cd samples/gateway/node`. +5. Now install the Node server's dependencies with `npm i`. +6. Now let's copy the environment example to a usable file `cp .env.example .env`. +7. Start the node server with `node --env-file=.env server.js`. + +You should see a response like this: +``` +Put result: {"success":"OK"} +Get result: {"success":"2025-04-29T16:13:42.097Z"}` +``` + diff --git a/samples/gateway/node/package-lock.json b/samples/gateway/node/package-lock.json new file mode 100644 index 000000000..e035f749b --- /dev/null +++ b/samples/gateway/node/package-lock.json @@ -0,0 +1,429 @@ +{ + "name": "node", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "node", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@grpc/grpc-js": "^1.13.3", + "@hyperledger/fabric-gateway": "^1.7.1" + } + }, + "node_modules/@grpc/grpc-js": { + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.13.3.tgz", + "integrity": "sha512-FTXHdOoPbZrBjlVLHuKbDZnsTxXv2BlHF57xw6LuThXacXvtkahEPED0CKMk6obZDf65Hv4k3z62eyPNpvinIg==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.7.13", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.15.tgz", + "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@hyperledger/fabric-gateway": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@hyperledger/fabric-gateway/-/fabric-gateway-1.7.1.tgz", + "integrity": "sha512-NNd9YchCJx8u2/XIcDH8EEQeYOgje66JsNcjP/Q5GeIJVRUzlxFRn4I67Ro+Q9PUHihKE7+YPS5ydBrSgJSiMA==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/grpc-js": "^1.12.0", + "@hyperledger/fabric-protos": "^0.3.0", + "@noble/curves": "^1.7.0", + "google-protobuf": "^3.21.0" + }, + "engines": { + "node": ">=18.12.0" + }, + "optionalDependencies": { + "pkcs11js": "^2.1.0" + } + }, + "node_modules/@hyperledger/fabric-protos": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@hyperledger/fabric-protos/-/fabric-protos-0.3.7.tgz", + "integrity": "sha512-p69dVT+QKrL7OZOuWRrimopNUAQL+VpgVEovud5MGqHSMl20S5hZy0aWqmIW+qasRgJiHLNuU0T6xVfXJIeHKg==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/grpc-js": "^1.11.0", + "google-protobuf": "^3.21.0" + }, + "engines": { + "node": ">=16.13.0" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@noble/curves": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.0.tgz", + "integrity": "sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@types/node": { + "version": "22.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", + "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/google-protobuf": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.4.tgz", + "integrity": "sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ==", + "license": "(BSD-3-Clause AND Apache-2.0)" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/pkcs11js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/pkcs11js/-/pkcs11js-2.1.6.tgz", + "integrity": "sha512-+t5jxzB749q8GaEd1yNx3l98xYuaVK6WW/Vjg1Mk1Iy5bMu/A5W4O/9wZGrpOknWF6lFQSb12FXX+eSNxdriwA==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/PeculiarVentures" + } + }, + "node_modules/protobufjs": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.0.tgz", + "integrity": "sha512-Z2E/kOY1QjoMlCytmexzYfDm/w5fKAiRwpSzGtdnXW1zC88Z2yXazHHrOtwCzn+7wSxyE8PYM4rvVcMphF9sOA==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/samples/gateway/node/package.json b/samples/gateway/node/package.json new file mode 100644 index 000000000..26844aa21 --- /dev/null +++ b/samples/gateway/node/package.json @@ -0,0 +1,21 @@ +{ + "name": "node-fablo-gateway", + "version": "1.0.0", + "description": "", + "license": "ISC", + "author": "", + "main": "server.js", + "type": "module", + "engines" : { + "node" : ">=22" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "dependencies": { + "@grpc/grpc-js": "^1.13.3", + "@hyperledger/fabric-gateway": "^1.7.1" + } +} + diff --git a/samples/gateway/node/server.js b/samples/gateway/node/server.js new file mode 100644 index 000000000..97c731a2c --- /dev/null +++ b/samples/gateway/node/server.js @@ -0,0 +1,40 @@ +import * as grpc from '@grpc/grpc-js'; +import { connect, hash, signers } from '@hyperledger/fabric-gateway'; +import * as crypto from 'node:crypto'; +import { promises as fs } from 'node:fs'; +import { TextDecoder } from 'node:util'; + +const utf8Decoder = new TextDecoder(); + +async function connection() { + const credentials = await fs.readFile(process.env.CREDENTIALS); + const privateKeyPem = await fs.readFile(process.env.PRIVATE_KEY_PEM); + const privateKey = crypto.createPrivateKey(privateKeyPem); + const signer = signers.newPrivateKeySigner(privateKey); + const tlsRootCert = await fs.readFile( + process.env.TLS_ROOT_CERT, + ); + const client = new grpc.Client(process.env.PEER_GATEWAY_URL, grpc.credentials.createSsl(tlsRootCert), { + "grpc.ssl_target_name_override": process.env.PEER_ORG_NAME, + }); + const gateway = connect({ + identity: { mspId: process.env.MSP_ID, credentials }, + signer, + hash: hash.sha256, + client, + }); + try { + const network = gateway.getNetwork(process.env.CHANNEL_NAME); + const contract = network.getContract(process.env.CONTRACT_NAME); + const putResult = await contract.submitTransaction('put', 'time', new Date().toISOString()); + console.log('Put result:', utf8Decoder.decode(putResult)); + const getResult = await contract.evaluateTransaction('get', 'time'); + console.log('Get result:', utf8Decoder.decode(getResult)); + } finally { + gateway.close(); + client.close(); + } +} + +connection().catch(console.error); + diff --git a/src/init/index.ts b/src/init/index.ts index 000730544..52d90bd11 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -1,7 +1,77 @@ import * as Generator from "yeoman-generator"; import * as chalk from "chalk"; -import parseFabloConfig from "../utils/parseFabloConfig"; -import { GlobalJson } from "../types/FabloConfigJson"; +import { GlobalJson, FabloConfigJson } from "../types/FabloConfigJson"; + +function getDefaultFabloConfig(): FabloConfigJson { + return { + $schema: "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", + global: { + fabricVersion: "2.5.9", + tls: false, + peerDevMode: false, + }, + orgs: [ + { + organization: { + name: "Orderer", + domain: "orderer.example.com", + mspName: "OrdererMSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [ + { + groupName: "group1", + type: "solo", + instances: 1, + prefix: "orderer", + }, + ], + }, + { + organization: { + name: "Org1", + domain: "org1.example.com", + mspName: "Org1MSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [], + peer: { + instances: 2, + db: "LevelDb", + prefix: "peer", + }, + }, + ], + channels: [ + { + name: "my-channel1", + orgs: [ + { + name: "Org1", + peers: ["peer0", "peer1"], + }, + ], + }, + ], + chaincodes: [ + { + name: "chaincode1", + version: "0.0.1", + lang: "node", + channel: "my-channel1", + directory: "./chaincodes/chaincode-kv-node", + privateData: [], + }, + ], + hooks: {}, + }; +} export default class InitGenerator extends Generator { constructor(readonly args: string[], opts: Generator.GeneratorOptions) { @@ -9,7 +79,7 @@ export default class InitGenerator extends Generator { } async copySampleConfig(): Promise { - let fabloConfigJson = parseFabloConfig(this.fs.read(this.templatePath("fablo-config.json"))); + let fabloConfigJson = getDefaultFabloConfig(); const shouldInitWithNodeChaincode = this.args.length && this.args.find((v) => v === "node"); if (shouldInitWithNodeChaincode) { @@ -48,4 +118,4 @@ export default class InitGenerator extends Generator { console.log("==========================================================="); }); } -} +} \ No newline at end of file diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index bbd7ba2f8..86cc22f48 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -1,19 +1,58 @@ import { sortVersions, version } from "./repositoryUtils"; describe("repositoryUtils", () => { + it("should sort versions", () => { - // Given - const unsortedVersions = ["0.0.2", "0.0.2-unstable", "0.0.1", "0.1.11", "0.1.1", "0.1.1-unstable", "1.21.2"]; + const unsorted = [ + "0.0.2", + "0.0.2-unstable", + "0.0.1", + "0.1.11", + "0.1.1", + "0.1.1-unstable", + "1.21.2", + ]; + + const expected = [ + "1.21.2", + "0.1.11", + "0.1.1", + "0.0.2", + "0.0.1", + "0.1.1-unstable", + "0.0.2-unstable", + ]; + + expect(sortVersions(unsorted)).toEqual(expected); + }); - // When - const sortedVersions = sortVersions(unsortedVersions); + it("should place pre‑release (named) tags after the matching stable tag", () => { + const unsorted = [ + "0.1.1-alpha", + "0.1.1-beta", + "0.1.2-alpha", + "0.1.2", + "0.1.1", + ]; - // Then - const expectedVersions = ["1.21.2", "0.1.11", "0.1.1", "0.0.2", "0.0.1", "0.1.1-unstable", "0.0.2-unstable"]; + const expected = [ + "0.1.2", + "0.1.1", + "0.1.2-alpha", + "0.1.1-beta", + "0.1.1-alpha", + ]; - expect(sortedVersions).toEqual(expectedVersions); + expect(sortVersions(unsorted)).toEqual(expected); }); + it("should handle multi digit fragments correctly", () => { + const unsorted = ["1.9.9", "1.10.0", "1.9.10"]; + const expected = ["1.10.0", "1.9.10", "1.9.9"]; + expect(sortVersions(unsorted)).toEqual(expected); + }); + + it("should compare versions", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); @@ -24,4 +63,22 @@ describe("repositoryUtils", () => { expect(version("3.0.0").isGreaterOrEqual("3.0.0")).toBe(true); expect(version("3.0.0").isGreaterOrEqual("3.0.1")).toBe(false); }); + + it("should treat pre-release tags as equal to the corresponding stable tag for ≥ comparison", () => { + expect(version("0.0.1-alpha").isGreaterOrEqual("0.0.1")).toBe(true); + expect(version("0.0.1").isGreaterOrEqual("0.0.1-alpha")).toBe(true); + }); + + + it("should check membership with isOneOf()", () => { + const list = ["1.2.3", "2.0.0", "3.1.4-alpha"]; + expect(version("1.2.3").isOneOf(list)).toBe(true); + expect(version("3.1.4").isOneOf(list)).toBe(false); + }); + + + it("should take major.minor fragments only", () => { + expect(version("10.5.7").takeMajorMinor()).toBe("10.5"); + expect(version("2.0.0-beta").takeMajorMinor()).toBe("2.0"); + }); }); diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index e88a7804b..081ea4890 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -64,7 +64,6 @@ export default class SetupDockerGenerator extends Generator { // ======= fabric-docker =========================================================== this._copyDockerComposeEnv(global, orgs, composeNetworkName); this._copyDockerCompose(config); - this._copyBuildScripts(config); // ======= scripts ================================================================== this._copyCommandsGeneratedScript(config); @@ -179,24 +178,6 @@ export default class SetupDockerGenerator extends Generator { ); } - _copyBuildScripts(config: FabloConfigExtended): void { - this.fs.copyTpl( - this.templatePath("fabric-docker/ccaas_builder/bin/build"), - this.destinationPath("fabric-docker/ccaas_builder/bin/build"), - config, - ); - this.fs.copyTpl( - this.templatePath("fabric-docker/ccaas_builder/bin/detect"), - this.destinationPath("fabric-docker/ccaas_builder/bin/detect"), - config, - ); - this.fs.copyTpl( - this.templatePath("fabric-docker/ccaas_builder/bin/release"), - this.destinationPath("fabric-docker/ccaas_builder/bin/release"), - config, - ); - } - _copyCommandsGeneratedScript(config: FabloConfigExtended): void { this.fs.copyTpl( this.templatePath("fabric-docker/channel-query-scripts.sh"), diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build deleted file mode 100755 index 0c11107ef..000000000 --- a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -SOURCE=$1 -OUTPUT=$3 - -#external chaincodes expect connection.json file in the chaincode package -if [ ! -f "$SOURCE/connection.json" ]; then - >&2 echo "$SOURCE/connection.json not found" - exit 1 -fi - -#simply copy the endpoint information to specified output location -cp $SOURCE/connection.json $OUTPUT/connection.json - -if [ -d "$SOURCE/metadata" ]; then - cp -a $SOURCE/metadata $OUTPUT/metadata -fi - -exit 0 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect deleted file mode 100755 index 8b35fcc16..000000000 --- a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -METADIR=$2 -#check if the "type" field is set to "external" -if [ "$(jq -r .type "$METADIR/metadata.json")" == "external" ]; then - exit 0 -fi - -exit 1 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release deleted file mode 100755 index 3ef77ad9a..000000000 --- a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -CONFIG="${CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG:-{}}" -echo "Releasing chaincode using config: $CONFIG" >&2 - -mkdir -p /tmp/ccaas_extratct -tar -xzf code.tar.gz -C /tmp/ccaas_extratct - -cat /tmp/ccaas_extratct/connection.json \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh b/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh index ea1428885..3607d49cc 100755 --- a/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh +++ b/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh @@ -31,34 +31,40 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - <% if (global.tls) { %> - peer_certs="" - <% } %> + + # Cli needs to be from the same org as the first peer <% orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - if [[ "$1" == *"<%= peer.address %>"* ]]; then + if [[ "$1" == "<%= peer.address %>"* ]]; then cli="<%= org.cli.address %>" - peer_addresses="$peer_addresses,<%= peer.fullAddress %>" - <% if(global.tls) { %> - peer_certs="$peer_certs,crypto/peers/<%= peer.address %>/tls/ca.crt" - <% } %> fi <% }) -%> <% }) -%> - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi - <% if(!global.tls) { %> - peerChaincodeInvoke "$cli" "${peer_addresses:1}" "$2" "$3" "$4" "$5" - <% } else { %> - <% channels.forEach((channel) => { %> + + peer_addresses="$1" + <% orgs.forEach((org) => { -%> + <% org.peers.forEach((peer) => { -%> + peer_addresses="${peer_addresses//<%= peer.address %>/<%= peer.fullAddress %>}" + <% }) -%> + <% }) -%> + + <% if (global.tls) { -%> + peer_certs="$1" + <% orgs.forEach((org) => { -%> + <% org.peers.forEach((peer) => { -%> + peer_certs="${peer_certs//<%= peer.address %>/crypto/peers/<%= peer.address %>/tls/ca.crt}" + <% }) -%> + <% }) -%> + <% } -%> + + <% if(!global.tls) { -%> + peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" + <% } else { -%> + <% channels.forEach((channel) => { -%> if [ "$2" = "<%= channel.name %>" ]; then ca_cert="crypto-orderer/tlsca.<%= ordererGroups[0].ordererHeads[0].domain %>-cert.pem" fi - <% }) %> - peerChaincodeInvokeTls "$cli" "${peer_addresses:1}" "$2" "$3" "$4" "$5" "${peer_certs:1}" "$ca_cert" - <% } %> + <% }) -%> + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" + <% } -%> } diff --git a/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh b/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh index 919f943b3..ab433dd44 100644 --- a/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh +++ b/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh @@ -5,8 +5,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp <% orgs.forEach((org) => { org.peers.forEach((peer) => { %> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 464a46acf..83cd43ce5 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -8,9 +8,9 @@ - global */-%> printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" -<% if (chaincode.lang === 'ccaas_builder') { -%> +<% if (chaincode.lang === "ccaas") { -%> <% chaincode.peerChaincodeInstances.forEach((instance) => { -%> - chaincodePackage <% -%> + chaincodePackageCaas <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= instance.peerAddress %>" <% -%> "<%= chaincode.name %>" <% -%> @@ -35,9 +35,6 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= chaincode.name %>" <% -%> "$version" <% -%> "<%= chaincode.lang %>" <% -%> - "<%= chaincode.image || '' %>" <% -%> - "<%= chaincode.port || '' %>" <% -%> - "<%= global.tls %>" <% } -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 2f6c4dd60..d4524e82b 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,23 +1,7 @@ networks: basic: -services: -<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> - <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> - <%= instance.containerName %>: - container_name: <%= instance.containerName %> - image: <%= chaincode.image %> - pull_policy: always - environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> - - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> - ports: - - <%= instance.port %>:7052 - networks: - - basic - <% }) %> -<% } }) %> - +services: <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> @@ -259,7 +243,6 @@ services: container_name: <%= peer.address %> image: hyperledger/fabric-peer:${FABRIC_VERSION} environment: - - CORE_CHAINCODE_EXTERNALBUILDERS=[{"name":"external","path":"/opt/hyperledger/ccaas_builder","propagateEnvironment":["CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG"]}] - CORE_PEER_LOCALMSPID=<%= org.mspName %> - CORE_PEER_ID=<%= peer.address %> - CORE_PEER_ADDRESS=<%= peer.fullAddress %> @@ -303,7 +286,7 @@ services: # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG="{\"peername\":\"<%= peer.address %>\"}" + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"<%= peer.name %><%= org.name %>"} <%_ } _%> working_dir: /etc/hyperledger/fabric/peer/ command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> @@ -324,7 +307,6 @@ services: - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/peers/<%= peer.address %>/tls:/etc/hyperledger/fabric/peer/tls - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/users:/etc/hyperledger/fabric/peer/msp/users - ../fabric-config/config:/etc/hyperledger/fabric/config - - ./ccaas_builder:/opt/hyperledger/ccaas_builder networks: - basic <%_ if(peer.db.type==="CouchDb") { _%> @@ -391,3 +373,18 @@ services: networks: - basic <%_ } _%> +<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> + <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> + <%= instance.containerName %>: + container_name: <%= instance.containerName %> + image: <%= chaincode.image %> + pull_policy: always + environment: + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> + - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + ports: + - <%= instance.port %>:7052 + networks: + - basic + <% }) %> +<% } }) %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 0ac8dce7c..1900939a1 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -87,6 +87,30 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \ + --lang "$CHAINCODE_LANG" \ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CONTAINER_PORT=$7 local CONTAINER_NAME=$8 @@ -95,54 +119,31 @@ chaincodePackage() { echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" + + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "$PACKAGE_DIR" + mkdir -p "$PACKAGE_DIR/code" + echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" - echo "{\"type\":\"external\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - mkdir -p "$PACKAGE_DIR/code" - echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - if docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; then - echo "Successfully copied chaincode package to $CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - else - echo "Failed to copy chaincode package to container" >&2 - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - return 1 - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi - - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \ - --lang "$CHAINCODE_LANG" \ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/src/utils/parseFabloConfig.test.ts b/src/utils/parseFabloConfig.test.ts new file mode 100644 index 000000000..77de1894a --- /dev/null +++ b/src/utils/parseFabloConfig.test.ts @@ -0,0 +1,149 @@ +import parseFabloConfig from "./parseFabloConfig"; + +describe("parseFabloConfig", () => { + it("should parse valid JSON config", () => { + const jsonConfig = `{ + "global": { + "fabricVersion": "2.5.9", + "tls": false, + "engine": "docker" + }, + "orgs": [ + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + } + } + ] + }`; + + const result = parseFabloConfig(jsonConfig); + + expect(result).toEqual({ + global: { + fabricVersion: "2.5.9", + tls: false, + engine: "docker" + }, + orgs: [ + { + organization: { + name: "Org1", + domain: "org1.example.com" + } + } + ] + }); + }); + + it("should parse valid YAML config", () => { + const yamlConfig = ` + global: + fabricVersion: "2.5.9" + tls: false + engine: docker + orgs: + - organization: + name: Org1 + domain: org1.example.com + `; + + const result = parseFabloConfig(yamlConfig); + + expect(result).toEqual({ + global: { + fabricVersion: "2.5.9", + tls: false, + engine: "docker" + }, + orgs: [ + { + organization: { + name: "Org1", + domain: "org1.example.com" + } + } + ] + }); + }); + + it("should parse complex YAML config with multiple orgs and channels", () => { + const yamlConfig = ` + global: + fabricVersion: "2.4.7" + tls: true + engine: kubernetes + orgs: + - organization: + name: Org1 + domain: org1.example.com + peers: + - name: peer0 + port: 7041 + - name: peer1 + port: 7042 + - organization: + name: Org2 + domain: org2.example.com + peers: + - name: peer0 + port: 8041 + channels: + - name: mychannel + orgs: ["Org1", "Org2"] + `; + + const result = parseFabloConfig(yamlConfig); + + expect(result).toEqual({ + global: { + fabricVersion: "2.4.7", + tls: true, + engine: "kubernetes" + }, + orgs: [ + { + organization: { + name: "Org1", + domain: "org1.example.com", + peers: [ + { + name: "peer0", + port: 7041 + }, + { + name: "peer1", + port: 7042 + } + ] + } + }, + { + organization: { + name: "Org2", + domain: "org2.example.com", + peers: [ + { + name: "peer0", + port: 8041 + } + ] + } + } + ], + channels: [ + { + name: "mychannel", + orgs: ["Org1", "Org2"] + } + ] + }); + }); + + it("should parse empty config", () => { + const emptyConfig = `{}`; + const result = parseFabloConfig(emptyConfig); + expect(result).toEqual({}); + }); +}); diff --git a/src/validate/index.ts b/src/validate/index.ts index cb9683b29..08b4d901e 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -1,5 +1,5 @@ import * as Generator from "yeoman-generator"; -// import { Validator as SchemaValidator } from "jsonschema"; +import { Validator as SchemaValidator } from "jsonschema"; import * as chalk from "chalk"; import * as config from "../config"; import parseFabloConfig from "../utils/parseFabloConfig"; @@ -91,7 +91,7 @@ class ValidateGenerator extends Generator { const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); this._validateFabricVersion(networkConfig.global); - // this._validateJsonSchema(networkConfig); + this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); this._validateEngineSpecificSettings(networkConfig); @@ -169,25 +169,25 @@ class ValidateGenerator extends Generator { } } - // _validateJsonSchema(configToValidate: FabloConfigJson) { - // const validator = new SchemaValidator(); - // const results = validator.validate(configToValidate, config.schema); - // results.errors.forEach((result) => { - // const msg = `${result.property} : ${result.message}`; - // const objectToEmit = { - // category: validationCategories.VALIDATION, - // message: msg, - // }; - // this.emit(validationErrorType.ERROR, objectToEmit); - // }); - // if (results.errors.length > 0) { - // const objectToEmit = { - // category: validationCategories.CRITICAL, - // message: "Json schema validation failed!", - // }; - // this.emit(validationErrorType.CRITICAL, objectToEmit); - // } - // } + _validateJsonSchema(configToValidate: FabloConfigJson) { + const validator = new SchemaValidator(); + const results = validator.validate(configToValidate, config.schema); + results.errors.forEach((result) => { + const msg = `${result.property} : ${result.message}`; + const objectToEmit = { + category: validationCategories.VALIDATION, + message: msg, + }; + this.emit(validationErrorType.ERROR, objectToEmit); + }); + if (results.errors.length > 0) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: "Json schema validation failed!", + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } _printIfNotEmpty(messages: Message[], caption: string) { if (messages.length > 0) { diff --git a/test-output.txt b/test-output.txt deleted file mode 100644 index 218c52003..000000000 --- a/test-output.txt +++ /dev/null @@ -1,64 +0,0 @@ - -> generator-fablo@2.2.0 test:e2e-update -> ./fablo-build.sh && jest e2e --runInBand --updateSnapshot && ./lint.sh - -allexport off -braceexpand on -emacs off -errexit on -errtrace off -functrace off -hashall on -histexpand off -history off -ignoreeof off -interactive-comments on -keyword off -monitor off -noclobber off -noexec off -noglob off -nolog off -notify off -nounset on -onecmd off -physical off -pipefail off -posix off -privileged off -verbose off -vi off -xtrace off -Building new image... - FABLO_HOME: /Users/artisan/Documents/workwith/opensource/fablo - FABLO_VERSION: 2.2.0 - VERSION_DETAILS: 2025-05-12-10:46:36-9154382 -Found '/Users/artisan/Documents/workwith/opensource/fablo/.nvmrc' with version <18> -Now using node v18.20.8 (npm v10.8.2) - -up to date, audited 1194 packages in 4s - -154 packages are looking for funding - run `npm fund` for details - -11 moderate severity vulnerabilities - -To address issues that do not require attention, run: - npm audit fix - -To address all issues (including breaking changes), run: - npm audit fix --force - -Run `npm audit` for details. - -> generator-fablo@2.2.0 build:dist -> npm run clean && tsc -p tsconfig-dist.json && npm run copydeps - - -> generator-fablo@2.2.0 clean -> rimraf generators - - -> generator-fablo@2.2.0 copydeps -> copyfiles --all --up 1 'src/*/templates/**' generators - From e3275db5088488ebe1510e88f6fdd1617c742573 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Thu, 5 Jun 2025 05:46:40 -0500 Subject: [PATCH 080/471] use lang in type for metadata.json Signed-off-by: Real-Artisan --- docs/schema.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index f66d2aaae..f2ddfc612 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -418,7 +418,7 @@ "lang", "channel" ], - "allOf": [ + "oneOf": [ { "if": { "properties": { "lang": { "const": "ccaas"}} diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index c07880f57..71969cf3d 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -55,9 +55,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas", + "lang": "node", "channel": "my-channel1", - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" + "directory": "./chaincodes/chaincode-kv-node" } ], "hooks": { From 7d3c6cbae59157bac05972c3ac5d948b66ae696e Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Fri, 6 Jun 2025 08:24:20 -0500 Subject: [PATCH 081/471] change fabric version Signed-off-by: Real-Artisan --- docs/schema.json | 2 +- e2e-network/docker/test-04-snapshot.sh | 2 +- .../templates/fabric-docker/core.yaml | 777 ++++++++++++++++++ 3 files changed, 779 insertions(+), 2 deletions(-) create mode 100644 src/setup-docker/templates/fabric-docker/core.yaml diff --git a/docs/schema.json b/docs/schema.json index f2ddfc612..f66d2aaae 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -418,7 +418,7 @@ "lang", "channel" ], - "oneOf": [ + "allOf": [ { "if": { "properties": { "lang": { "const": "ccaas"}} diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index 510268015..b853dc42c 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -58,7 +58,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" -waitForContainer "peer0.org1.example.com_chaincode1" "Bootstrap process completed" +# waitForContainer "chaincode1_peer0.org1.example.com" "Bootstrap process completed" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" diff --git a/src/setup-docker/templates/fabric-docker/core.yaml b/src/setup-docker/templates/fabric-docker/core.yaml new file mode 100644 index 000000000..7c3148143 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/core.yaml @@ -0,0 +1,777 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################### +# +# Peer section +# +############################################################################### +peer: + + # The peer id provides a name for this peer instance and is used when + # naming docker resources. + id: jdoe + + # The networkId allows for logical separation of networks and is used when + # naming docker resources. + networkId: dev + + # The Address at local network interface this Peer will listen on. + # By default, it will listen on all network interfaces + listenAddress: 0.0.0.0:7051 + + # The endpoint this peer uses to listen for inbound chaincode connections. + # If this is commented-out, the listen address is selected to be + # the peer's address (see below) with port 7052 + # chaincodeListenAddress: 0.0.0.0:7052 + + # The endpoint the chaincode for this peer uses to connect to the peer. + # If this is not specified, the chaincodeListenAddress address is selected. + # And if chaincodeListenAddress is not specified, address is selected from + # peer address (see below). If specified peer address is invalid then it + # will fallback to the auto detected IP (local IP) regardless of the peer + # addressAutoDetect value. + # chaincodeAddress: 0.0.0.0:7052 + + # When used as peer config, this represents the endpoint to other peers + # in the same organization. For peers in other organization, see + # gossip.externalEndpoint for more info. + # When used as CLI config, this means the peer's endpoint to interact with + address: 0.0.0.0:7051 + + # Whether the Peer should programmatically determine its address + # This case is useful for docker containers. + # When set to true, will override peer address. + addressAutoDetect: false + + # Settings for the Peer's gateway server. + gateway: + # Whether the gateway is enabled for this Peer. + enabled: true + # endorsementTimeout is the duration the gateway waits for a response + # from other endorsing peers before returning a timeout error to the client. + endorsementTimeout: 30s + # dialTimeout is the duration the gateway waits for a connection + # to other network nodes. + dialTimeout: 2m + + + # Keepalive settings for peer server and clients + keepalive: + # Interval is the duration after which if the server does not see + # any activity from the client it pings the client to see if it's alive + interval: 7200s + # Timeout is the duration the server waits for a response + # from the client after sending a ping before closing the connection + timeout: 20s + # MinInterval is the minimum permitted time between client pings. + # If clients send pings more frequently, the peer server will + # disconnect them + minInterval: 60s + # Client keepalive settings for communicating with other peer nodes + client: + # Interval is the time between pings to peer nodes. This must + # greater than or equal to the minInterval specified by peer + # nodes + interval: 60s + # Timeout is the duration the client waits for a response from + # peer nodes before closing the connection + timeout: 20s + # DeliveryClient keepalive settings for communication with ordering + # nodes. + deliveryClient: + # Interval is the time between pings to ordering nodes. This must + # greater than or equal to the minInterval specified by ordering + # nodes. + interval: 60s + # Timeout is the duration the client waits for a response from + # ordering nodes before closing the connection + timeout: 20s + + + # Gossip related configuration + gossip: + # Bootstrap set to initialize gossip with. + # This is a list of other peers that this peer reaches out to at startup. + # Important: The endpoints here have to be endpoints of peers in the same + # organization, because the peer would refuse connecting to these endpoints + # unless they are in the same organization as the peer. + bootstrap: 127.0.0.1:7051 + + # NOTE: orgLeader and useLeaderElection parameters are mutual exclusive. + # Setting both to true would result in the termination of the peer + # since this is undefined state. If the peers are configured with + # useLeaderElection=false, make sure there is at least 1 peer in the + # organization that its orgLeader is set to true. + + # Defines whenever peer will initialize dynamic algorithm for + # "leader" selection, where leader is the peer to establish + # connection with ordering service and use delivery protocol + # to pull ledger blocks from ordering service. + useLeaderElection: false + # Statically defines peer to be an organization "leader", + # where this means that current peer will maintain connection + # with ordering service and disseminate block across peers in + # its own organization. Multiple peers or all peers in an organization + # may be configured as org leaders, so that they all pull + # blocks directly from ordering service. + orgLeader: true + + # Interval for membershipTracker polling + membershipTrackerInterval: 5s + + # Overrides the endpoint that the peer publishes to peers + # in its organization. For peers in foreign organizations + # see 'externalEndpoint' + endpoint: + # Maximum count of blocks stored in memory + maxBlockCountToStore: 10 + # Max time between consecutive message pushes(unit: millisecond) + maxPropagationBurstLatency: 10ms + # Max number of messages stored until a push is triggered to remote peers + maxPropagationBurstSize: 10 + # Number of times a message is pushed to remote peers + propagateIterations: 1 + # Number of peers selected to push messages to + propagatePeerNum: 3 + # Determines frequency of pull phases(unit: second) + # Must be greater than digestWaitTime + responseWaitTime + pullInterval: 4s + # Number of peers to pull from + pullPeerNum: 3 + # Determines frequency of pulling state info messages from peers(unit: second) + requestStateInfoInterval: 4s + # Determines frequency of pushing state info messages to peers(unit: second) + publishStateInfoInterval: 4s + # Maximum time a stateInfo message is kept until expired + stateInfoRetentionInterval: + # Time from startup certificates are included in Alive messages(unit: second) + publishCertPeriod: 10s + # Should we skip verifying block messages or not (currently not in use) + skipBlockVerification: false + # Dial timeout(unit: second) + dialTimeout: 3s + # Connection timeout(unit: second) + connTimeout: 2s + # Buffer size of received messages + recvBuffSize: 20 + # Buffer size of sending messages + sendBuffSize: 200 + # Time to wait before pull engine processes incoming digests (unit: second) + # Should be slightly smaller than requestWaitTime + digestWaitTime: 1s + # Time to wait before pull engine removes incoming nonce (unit: milliseconds) + # Should be slightly bigger than digestWaitTime + requestWaitTime: 1500ms + # Time to wait before pull engine ends pull (unit: second) + responseWaitTime: 2s + # Alive check interval(unit: second) + aliveTimeInterval: 5s + # Alive expiration timeout(unit: second) + aliveExpirationTimeout: 25s + # Reconnect interval(unit: second) + reconnectInterval: 25s + # Max number of attempts to connect to a peer + maxConnectionAttempts: 120 + # Message expiration factor for alive messages + msgExpirationFactor: 20 + # This is an endpoint that is published to peers outside of the organization. + # If this isn't set, the peer will not be known to other organizations. + externalEndpoint: + # Leader election service configuration + election: + # Longest time peer waits for stable membership during leader election startup (unit: second) + startupGracePeriod: 15s + # Interval gossip membership samples to check its stability (unit: second) + membershipSampleInterval: 1s + # Time passes since last declaration message before peer decides to perform leader election (unit: second) + leaderAliveThreshold: 10s + # Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second) + leaderElectionDuration: 5s + + pvtData: + # pullRetryThreshold determines the maximum duration of time private data corresponding for a given block + # would be attempted to be pulled from peers until the block would be committed without the private data + pullRetryThreshold: 60s + # As private data enters the transient store, it is associated with the peer's ledger's height at that time. + # transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit, + # and the private data residing inside the transient store that is guaranteed not to be purged. + # Private data is purged from the transient store when blocks with sequences that are multiples + # of transientstoreMaxBlockRetention are committed. + transientstoreMaxBlockRetention: 1000 + # pushAckTimeout is the maximum time to wait for an acknowledgement from each peer + # at private data push at endorsement time. + pushAckTimeout: 3s + # Block to live pulling margin, used as a buffer + # to prevent peer from trying to pull private data + # from peers that is soon to be purged in next N blocks. + # This helps a newly joined peer catch up to current + # blockchain height quicker. + btlPullMargin: 10 + # the process of reconciliation is done in an endless loop, while in each iteration reconciler tries to + # pull from the other peers the most recent missing blocks with a maximum batch size limitation. + # reconcileBatchSize determines the maximum batch size of missing private data that will be reconciled in a + # single iteration. + reconcileBatchSize: 10 + # reconcileSleepInterval determines the time reconciler sleeps from end of an iteration until the beginning + # of the next reconciliation iteration. + reconcileSleepInterval: 1m + # reconciliationEnabled is a flag that indicates whether private data reconciliation is enable or not. + reconciliationEnabled: true + # skipPullingInvalidTransactionsDuringCommit is a flag that indicates whether pulling of invalid + # transaction's private data from other peers need to be skipped during the commit time and pulled + # only through reconciler. + skipPullingInvalidTransactionsDuringCommit: false + # implicitCollectionDisseminationPolicy specifies the dissemination policy for the peer's own implicit collection. + # When a peer endorses a proposal that writes to its own implicit collection, below values override the default values + # for disseminating private data. + # Note that it is applicable to all channels the peer has joined. The implication is that requiredPeerCount has to + # be smaller than the number of peers in a channel that has the lowest numbers of peers from the organization. + implicitCollectionDisseminationPolicy: + # requiredPeerCount defines the minimum number of eligible peers to which the peer must successfully + # disseminate private data for its own implicit collection during endorsement. Default value is 0. + requiredPeerCount: 0 + # maxPeerCount defines the maximum number of eligible peers to which the peer will attempt to + # disseminate private data for its own implicit collection during endorsement. Default value is 1. + maxPeerCount: 1 + + # Gossip state transfer related configuration + state: + # indicates whenever state transfer is enabled or not + # default value is false, i.e. state transfer is active + # and takes care to sync up missing blocks allowing + # lagging peer to catch up to speed with rest network. + # Keep in mind that when peer.gossip.useLeaderElection is true + # and there are several peers in the organization, + # or peer.gossip.useLeaderElection is false alongside with + # peer.gossip.orgleader being false, the peer's ledger may lag behind + # the rest of the peers and will never catch up due to state transfer + # being disabled. + enabled: false + # checkInterval interval to check whether peer is lagging behind enough to + # request blocks via state transfer from another peer. + checkInterval: 10s + # responseTimeout amount of time to wait for state transfer response from + # other peers + responseTimeout: 3s + # batchSize the number of blocks to request via state transfer from another peer + batchSize: 10 + # blockBufferSize reflects the size of the re-ordering buffer + # which captures blocks and takes care to deliver them in order + # down to the ledger layer. The actual buffer size is bounded between + # 0 and 2*blockBufferSize, each channel maintains its own buffer + blockBufferSize: 20 + # maxRetries maximum number of re-tries to ask + # for single state transfer request + maxRetries: 3 + + # TLS Settings + tls: + # Require server-side TLS + enabled: false + # Require client certificates / mutual TLS for inbound connections. + # Note that clients that are not configured to use a certificate will + # fail to connect to the peer. + clientAuthRequired: false + # X.509 certificate used for TLS server + cert: + file: tls/server.crt + # Private key used for TLS server + key: + file: tls/server.key + # rootcert.file represents the trusted root certificate chain used for verifying certificates + # of other nodes during outbound connections. + # It is not required to be set, but can be used to augment the set of TLS CA certificates + # available from the MSPs of each channel’s configuration. + rootcert: + file: tls/ca.crt + # If mutual TLS is enabled, clientRootCAs.files contains a list of additional root certificates + # used for verifying certificates of client connections. + # It augments the set of TLS CA certificates available from the MSPs of each channel’s configuration. + # Minimally, set your organization's TLS CA root certificate so that the peer can receive join channel requests. + clientRootCAs: + files: + - tls/ca.crt + # Private key used for TLS when making client connections. + # If not set, peer.tls.key.file will be used instead + clientKey: + file: + # X.509 certificate used for TLS when making client connections. + # If not set, peer.tls.cert.file will be used instead + clientCert: + file: + + # Authentication contains configuration parameters related to authenticating + # client messages + authentication: + # the acceptable difference between the current server time and the + # client's time as specified in a client request message + timewindow: 15m + + # Path on the file system where peer will store data (eg ledger). This + # location must be access control protected to prevent unintended + # modification that might corrupt the peer operations. + fileSystemPath: /var/hyperledger/production + + # BCCSP (Blockchain crypto provider): Select which crypto implementation or + # library to use + BCCSP: + Default: SW + # Settings for the SW crypto provider (i.e. when DEFAULT: SW) + SW: + # TODO: The default Hash and Security level needs refactoring to be + # fully configurable. Changing these defaults requires coordination + # SHA2 is hardcoded in several places, not only BCCSP + Hash: SHA2 + Security: 256 + # Location of Key Store + FileKeyStore: + # If "", defaults to 'mspConfigPath'/keystore + KeyStore: + # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11) + PKCS11: + # Location of the PKCS11 module library + Library: + # Token Label + Label: + # User PIN + Pin: + Hash: + Security: + + # Path on the file system where peer will find MSP local configurations + mspConfigPath: msp + # Identifier of the local MSP + # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!---- + # Deployers need to change the value of the localMspId string. + # In particular, the name of the local MSP ID of a peer needs + # to match the name of one of the MSPs in each of the channel + # that this peer is a member of. Otherwise this peer's messages + # will not be identified as valid by other nodes. + localMspId: SampleOrg + + # CLI common client config options + client: + # connection timeout + connTimeout: 3s + + # Delivery service related config + deliveryclient: + # Enables this peer to disseminate blocks it pulled from the ordering service + # via gossip. + # Note that 'gossip.state.enabled' controls point to point block replication + # of blocks committed in the past. + blockGossipEnabled: true + # It sets the total time the delivery service may spend in reconnection + # attempts until its retry logic gives up and returns an error + reconnectTotalTimeThreshold: 3600s + + # It sets the delivery service <-> ordering service node connection timeout + connTimeout: 3s + + # It sets the delivery service maximal delay between consecutive retries + reConnectBackoffThreshold: 3600s + + # A list of orderer endpoint addresses which should be overridden + # when found in channel configurations. + addressOverrides: + # - from: + # to: + # caCertsFile: + # - from: + # to: + # caCertsFile: + + # Type for the local MSP - by default it's of type bccsp + localMspType: bccsp + + # Used with Go profiling tools only in none production environment. In + # production, it should be disabled (eg enabled: false) + profile: + enabled: false + listenAddress: 0.0.0.0:6060 + + # Handlers defines custom handlers that can filter and mutate + # objects passing within the peer, such as: + # Auth filter - reject or forward proposals from clients + # Decorators - append or mutate the chaincode input passed to the chaincode + # Endorsers - Custom signing over proposal response payload and its mutation + # Valid handler definition contains: + # - A name which is a factory method name defined in + # core/handlers/library/library.go for statically compiled handlers + # - library path to shared object binary for pluggable filters + # Auth filters and decorators are chained and executed in the order that + # they are defined. For example: + # authFilters: + # - + # name: FilterOne + # library: /opt/lib/filter.so + # - + # name: FilterTwo + # decorators: + # - + # name: DecoratorOne + # - + # name: DecoratorTwo + # library: /opt/lib/decorator.so + # Endorsers are configured as a map that its keys are the endorsement system chaincodes that are being overridden. + # Below is an example that overrides the default ESCC and uses an endorsement plugin that has the same functionality + # as the default ESCC. + # If the 'library' property is missing, the name is used as the constructor method in the builtin library similar + # to auth filters and decorators. + # endorsers: + # escc: + # name: DefaultESCC + # library: /etc/hyperledger/fabric/plugin/escc.so + handlers: + authFilters: + - + name: DefaultAuth + - + name: ExpirationCheck # This filter checks identity x509 certificate expiration + decorators: + - + name: DefaultDecorator + endorsers: + escc: + name: DefaultEndorsement + library: + validators: + vscc: + name: DefaultValidation + library: + + # library: /etc/hyperledger/fabric/plugin/escc.so + # Number of goroutines that will execute transaction validation in parallel. + # By default, the peer chooses the number of CPUs on the machine. Set this + # variable to override that choice. + # NOTE: overriding this value might negatively influence the performance of + # the peer so please change this value only if you know what you're doing + validatorPoolSize: + + # The discovery service is used by clients to query information about peers, + # such as - which peers have joined a certain channel, what is the latest + # channel config, and most importantly - given a chaincode and a channel, + # what possible sets of peers satisfy the endorsement policy. + discovery: + enabled: true + # Whether the authentication cache is enabled or not. + authCacheEnabled: true + # The maximum size of the cache, after which a purge takes place + authCacheMaxSize: 1000 + # The proportion (0 to 1) of entries that remain in the cache after the cache is purged due to overpopulation + authCachePurgeRetentionRatio: 0.75 + # Whether to allow non-admins to perform non channel scoped queries. + # When this is false, it means that only peer admins can perform non channel scoped queries. + orgMembersAllowedAccess: false + + # Limits is used to configure some internal resource limits. + limits: + # Concurrency limits the number of concurrently running requests to a service on each peer. + # Currently this option is only applied to endorser service and deliver service. + # When the property is missing or the value is 0, the concurrency limit is disabled for the service. + concurrency: + # endorserService limits concurrent requests to endorser service that handles chaincode deployment, query and invocation, + # including both user chaincodes and system chaincodes. + endorserService: 2500 + # deliverService limits concurrent event listeners registered to deliver service for blocks and transaction events. + deliverService: 2500 + + # Since all nodes should be consistent it is recommended to keep + # the default value of 100MB for MaxRecvMsgSize & MaxSendMsgSize + # Max message size in bytes GRPC server and client can receive + maxRecvMsgSize: 104857600 + # Max message size in bytes GRPC server and client can send + maxSendMsgSize: 104857600 + +############################################################################### +# +# VM section +# +############################################################################### +vm: + + # Endpoint of the vm management system. For docker can be one of the following in general + # unix:///var/run/docker.sock + # http://localhost:2375 + # https://localhost:2376 + # If you utilize external chaincode builders and don't need the default Docker chaincode builder, + # the endpoint should be unconfigured so that the peer's Docker health checker doesn't get registered. + endpoint: unix:///var/run/docker.sock + + # settings for docker vms + docker: + tls: + enabled: false + ca: + file: docker/ca.crt + cert: + file: docker/tls.crt + key: + file: docker/tls.key + + # Enables/disables the standard out/err from chaincode containers for + # debugging purposes + attachStdout: false + + # Parameters on creating docker container. + # Container may be efficiently created using ipam & dns-server for cluster + # NetworkMode - sets the networking mode for the container. Supported + # standard values are: `host`(default),`bridge`,`ipvlan`,`none`. + # Dns - a list of DNS servers for the container to use. + # Note: `Privileged` `Binds` `Links` and `PortBindings` properties of + # Docker Host Config are not supported and will not be used if set. + # LogConfig - sets the logging driver (Type) and related options + # (Config) for Docker. For more info, + # https://docs.docker.com/engine/admin/logging/overview/ + # Note: Set LogConfig using Environment Variables is not supported. + hostConfig: + NetworkMode: host + Dns: + # - 192.168.0.1 + LogConfig: + Type: json-file + Config: + max-size: "50m" + max-file: "5" + Memory: 2147483648 + +############################################################################### +# +# Chaincode section +# +############################################################################### +chaincode: + + # The id is used by the Chaincode stub to register the executing Chaincode + # ID with the Peer and is generally supplied through ENV variables + # the `path` form of ID is provided when installing the chaincode. + # The `name` is used for all other requests and can be any string. + id: + path: + name: + + # Generic builder environment, suitable for most chaincode types + builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION) + + # Enables/disables force pulling of the base docker images (listed below) + # during user chaincode instantiation. + # Useful when using moving image tags (such as :latest) + pull: false + + golang: + # golang will never need more than baseos + runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION) + + # whether or not golang chaincode should be linked dynamically + dynamicLink: false + + java: + # This is an image based on java:openjdk-8 with addition compiler + # tools added for java shim layer packaging. + # This image is packed with shim layer libraries that are necessary + # for Java chaincode runtime. + runtime: $(DOCKER_NS)/fabric-javaenv:2.5 + + node: + # This is an image based on node:$(NODE_VER)-alpine + runtime: $(DOCKER_NS)/fabric-nodeenv:2.5 + + # List of directories to treat as external builders and launchers for + # chaincode. The external builder detection processing will iterate over the + # builders in the order specified below. + # If you don't need to fallback to the default Docker builder, also unconfigure vm.endpoint above. + # To override this property via env variable use CORE_CHAINCODE_EXTERNALBUILDERS: [{name: x, path: dir1}, {name: y, path: dir2}] + externalBuilders: + - name: ccaas_builder + path: /opt/hyperledger/ccaas_builder + propagateEnvironment: + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG + + + # The maximum duration to wait for the chaincode build and install process + # to complete. + installTimeout: 300s + + # Timeout duration for starting up a container and waiting for Register + # to come through. + startuptimeout: 300s + + # Timeout duration for Invoke and Init calls to prevent runaway. + # This timeout is used by all chaincodes in all the channels, including + # system chaincodes. + # Note that during Invoke, if the image is not available (e.g. being + # cleaned up when in development environment), the peer will automatically + # build the image, which might take more time. In production environment, + # the chaincode image is unlikely to be deleted, so the timeout could be + # reduced accordingly. + executetimeout: 30s + + # There are 2 modes: "dev" and "net". + # In dev mode, user runs the chaincode after starting peer from + # command line on local machine. + # In net mode, peer will run chaincode in a docker container. + mode: net + + # keepalive in seconds. In situations where the communication goes through a + # proxy that does not support keep-alive, this parameter will maintain connection + # between peer and chaincode. + # A value <= 0 turns keepalive off + keepalive: 0 + + # enabled system chaincodes + system: + _lifecycle: enable + cscc: enable + lscc: enable + qscc: enable + + # Logging section for the chaincode container + logging: + # Default level for all loggers within the chaincode container + level: info + # Override default level for the 'shim' logger + shim: warning + # Format for the chaincode container logs + format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' + +############################################################################### +# +# Ledger section - ledger configuration encompasses both the blockchain +# and the state +# +############################################################################### +ledger: + + blockchain: + + state: + # stateDatabase - options are "goleveldb", "CouchDB" + # goleveldb - default state database stored in goleveldb. + # CouchDB - store state database in CouchDB + stateDatabase: goleveldb + # Limit on the number of records to return per query + totalQueryLimit: 100000 + couchDBConfig: + # It is recommended to run CouchDB on the same server as the peer, and + # not map the CouchDB container port to a server port in docker-compose. + # Otherwise proper security must be provided on the connection between + # CouchDB client (on the peer) and server. + couchDBAddress: 127.0.0.1:5984 + # This username must have read and write authority on CouchDB + username: + # The password is recommended to pass as an environment variable + # during start up (eg CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD). + # If it is stored here, the file must be access control protected + # to prevent unintended users from discovering the password. + password: + # Number of retries for CouchDB errors + maxRetries: 3 + # Number of retries for CouchDB errors during peer startup. + # The delay between retries doubles for each attempt. + # Default of 10 retries results in 11 attempts over 2 minutes. + maxRetriesOnStartup: 10 + # CouchDB request timeout (unit: duration, e.g. 20s) + requestTimeout: 35s + # Limit on the number of records per each CouchDB query + # Note that chaincode queries are only bound by totalQueryLimit. + # Internally the chaincode may execute multiple CouchDB queries, + # each of size internalQueryLimit. + internalQueryLimit: 1000 + # Limit on the number of records per CouchDB bulk update batch + maxBatchUpdateSize: 1000 + # Create the _global_changes system database + # This is optional. Creating the global changes database will require + # additional system resources to track changes and maintain the database + createGlobalChangesDB: false + # CacheSize denotes the maximum mega bytes (MB) to be allocated for the in-memory state + # cache. Note that CacheSize needs to be a multiple of 32 MB. If it is not a multiple + # of 32 MB, the peer would round the size to the next multiple of 32 MB. + # To disable the cache, 0 MB needs to be assigned to the cacheSize. + cacheSize: 64 + + history: + # enableHistoryDatabase - options are true or false + # Indicates if the history of key updates should be stored. + # All history 'index' will be stored in goleveldb, regardless if using + # CouchDB or alternate database for the state. + enableHistoryDatabase: true + + pvtdataStore: + # the maximum db batch size for converting + # the ineligible missing data entries to eligible missing data entries + collElgProcMaxDbBatchSize: 5000 + # the minimum duration (in milliseconds) between writing + # two consecutive db batches for converting the ineligible missing data entries to eligible missing data entries + collElgProcDbBatchesInterval: 1000 + # The missing data entries are classified into two categories: + # (1) prioritized + # (2) deprioritized + # Initially, all missing data are in the prioritized list. When the + # reconciler is unable to fetch the missing data from other peers, + # the unreconciled missing data would be moved to the deprioritized list. + # The reconciler would retry deprioritized missing data after every + # deprioritizedDataReconcilerInterval (unit: minutes). Note that the + # interval needs to be greater than the reconcileSleepInterval + deprioritizedDataReconcilerInterval: 60m + + snapshots: + # Path on the file system where peer will store ledger snapshots + rootDir: /var/hyperledger/production/snapshots + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # most operations service endpoints require client authentication when TLS + # is enabled. clientAuthRequired requires client certificate authentication + # at the TLS layer to access all resources. + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # metrics provider is one of statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: \ No newline at end of file From e4012cdb684aa7116f409d2fc27eeceb7c2ee123 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Fri, 6 Jun 2025 10:44:35 -0500 Subject: [PATCH 082/471] Chaincode install test passed Signed-off-by: Real-Artisan --- e2e/__snapshots__/extendConfig.test.ts.snap | 230 +- ...1chaincode-raft-explorer.json.test.ts.snap | 3367 +---------------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 8 +- ...2chaincodes-private-data.yaml.test.ts.snap | 24 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 16 +- ...1chaincode-raft-explorer.json.test.ts.snap | 8 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 8 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 8 +- src/.DS_Store | Bin 0 -> 6148 bytes src/setup-docker/.DS_Store | Bin 0 -> 6148 bytes src/setup-docker/templates/.DS_Store | Bin 0 -> 8196 bytes .../templates/fabric-docker/.DS_Store | Bin 0 -> 6148 bytes .../templates/fabric-docker/core.yaml | 777 ---- 13 files changed, 51 insertions(+), 4395 deletions(-) create mode 100644 src/.DS_Store create mode 100644 src/setup-docker/.DS_Store create mode 100644 src/setup-docker/templates/.DS_Store create mode 100644 src/setup-docker/templates/fabric-docker/.DS_Store delete mode 100644 src/setup-docker/templates/fabric-docker/core.yaml diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index f9b00a23c..d72aa5fbc 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1725,23 +1725,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -1867,23 +1851,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -1956,23 +1924,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "lang": "ccaas", "name": "chaincode1", @@ -2054,23 +2006,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -2196,23 +2132,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -2243,12 +2163,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabloConfig": "", }, "tls": true, - "tools": { - "explorer": { - "address": "explorer.example.com", - "port": 7010, - }, - }, + "tools": {}, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -2443,23 +2358,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], } @@ -11163,23 +11062,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -11305,23 +11188,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -11394,23 +11261,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "lang": "ccaas", "name": "chaincode1", @@ -11492,23 +11343,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -11634,23 +11469,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -11681,12 +11500,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabloConfig": "", }, "tls": true, - "tools": { - "explorer": { - "address": "explorer.example.com", - "port": 7010, - }, - }, + "tools": {}, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -11881,23 +11695,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index f83115f3a..b79c8f74e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3368 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"/config -/crypto-config -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"################################################################################ -# SECTION: Capabilities -################################################################################ -Capabilities: - Channel: &ChannelCapabilities - V2_0: true - Orderer: &OrdererCapabilities - V2_0: true - Application: &ApplicationCapabilities - V2_5: true - -################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - EtcdRaft: - Consenters: - - Host: orderer0.group1.orderer.example.com - Port: 7030 - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 1 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Orderer - - *Org1 - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *ApplicationCapabilities - Consortium: SampleConsortium - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-orderer", - "description": "Connection profile for Orderer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Orderer" - }, - "organizations": { - "Orderer": { - "mspid": "OrdererMSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.orderer.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.orderer.example.com": { - "url": "https://localhost:7020", - "caName": "ca.orderer.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-orderer -description: Connection profile for Orderer in Fablo network -version: 1.0.0 -client: - organization: Orderer -organizations: - Orderer: - mspid: OrdererMSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.orderer.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.orderer.example.com: - url: https://localhost:7020 - caName: ca.orderer.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Org1 in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1" - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.org1.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.org1.example.com": { - "url": "https://localhost:7040", - "caName": "ca.org1.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-org1 -description: Connection profile for Org1 in Fablo network -version: 1.0.0 -client: - organization: Org1 -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.org1.example.com: - url: https://localhost:7040 - caName: ca.org1.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - Template: - Count: 0 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Org1 - Domain: org1.example.com - Specs: - Template: - Count: 1 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Hyperledger Explorer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1", - "tlsEnable": true, - "enableAuthentication": true, - "adminCredential": { - "id": "admin", - "password": "adminpw" - }, - "connection": { - "timeout": { - "peer": { - "endorser": "300" - }, - "orderer": "300" - } - } - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "adminPrivateKey": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" - }, - "peers": [ - "peer0.org1.example.com" - ], - "signedCert": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" - } - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://peer0.org1.example.com:7041", - "tlsCACerts": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" - } - } - }, - "channels": { - "my-channel1": { - "peers": {} - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - orderer: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - org1: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - notifyOrgsAboutChannels - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "\${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "\${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.2.0 -FABLO_BUILD= -FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 - -COUCHDB_VERSION=3.1 -FABRIC_COUCHDB_VERSION=0.4.18 - -FABLO_CONFIG= -CHAINCODES_BASE_DIR= - -COMPOSE_PROJECT_NAME= -LOGGING_LEVEL=info - -FABRIC_VERSION=2.5.12 -FABRIC_TOOLS_VERSION=2.5.12 -FABRIC_CA_VERSION=1.5.5 -FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=2.5.12 -FABRIC_BASEOS_VERSION=2.5.12 -FABRIC_JAVAENV_VERSION=2.5 -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=16 - -ROOT_CA_ADMIN_NAME=admin -ROOT_CA_ADMIN_PASSWORD=adminpw - -ORDERER_CA_ADMIN_NAME=admin -ORDERER_CA_ADMIN_PASSWORD=adminpw - -ORG1_CA_ADMIN_NAME=admin -ORG1_CA_ADMIN_PASSWORD=adminpw - -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -chaincodeList() { - if [ "$#" -ne 2 ]; then - echo "Expected 2 parameters for chaincode list, but got: $*" - exit 1 - - elif [ "$1" = "peer0.org1.example.com" ]; then - - peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - - else - - echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" - exit 1 - - fi -} - -# Function to perform chaincode invoke. Accepts 5 parameters: -# 1. comma-separated peers -# 2. channel name -# 3. chaincode name -# 4. chaincode command -# 5. transient data (optional) -chaincodeInvoke() { - if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then - echo "Expected 4 or 5 parameters for chaincode list, but got: $*" - echo "Usage: fablo chaincode invoke [transient]" - exit 1 - fi - - # Cli needs to be from the same org as the first peer - if [[ "$1" == "peer0.org1.example.com"* ]]; then - cli="cli.org1.example.com" - fi - - peer_addresses="$1" - peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" - - peer_certs="$1" - peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" - - if [ "$2" = "my-channel1" ]; then - ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" - fi - peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" - -set -eu - -channelQuery() { - if [ "$#" -eq 1 ]; then - printChannelsHelp - - elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then - - peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif - - [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] - then - - peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - TARGET_FILE=\${6:-"$channel-config.json"} - - peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - BLOCK_NAME=$2 - TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - - peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - - else - - echo "$@" - echo "$1, $2, $3, $4, $5, $6, $7, $#" - printChannelsHelp - fi - -} - -printChannelsHelp() { - echo "Channel management commands:" - echo "" - - echo "fablo channel list org1 peer0" - echo -e "\\t List channels on 'peer0' of 'Org1'". - echo "" - - echo "fablo channel getinfo my-channel1 org1 peer0" - echo -e "\\t Get channel info on 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" - echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch my-channel1 org1 peer0 [file name]" - echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -generateArtifacts() { - printHeadline "Generating basic configs" "U1F913" - - printItalics "Generating crypto material for Orderer" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating crypto material for Org1" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating genesis block for group group1" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - - # Create directories to avoid permission errors on linux - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -startNetwork() { - printHeadline "Starting network" "U1F680" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - sleep 4 -} - -generateChannelsArtifacts() { - printHeadline "Generating config for 'my-channel1'" "U1F913" - createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -installChannels() { - printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - -} - -installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - local version="0.0.1" - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - else - echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - -} - -installChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - fi -} - -runDevModeChaincode() { - local chaincodeName=$1 - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - local version="0.0.1" - printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" - - fi -} - -upgradeChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - fi -} - -notifyOrgsAboutChannels() { - - printHeadline "Creating new channel config blocks" "U1F537" - createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" - - printHeadline "Notyfing orgs about channels" "U1F4E2" - notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - printHeadline "Deleting new channel config blocks" "U1F52A" - deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" - -} - -printStartSuccessInfo() { - printHeadline "Done! Enjoy your fresh network" "U1F984" -} - -stopNetwork() { - printHeadline "Stopping network" "U1F68F" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) - sleep 4 -} - -networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do - echo "Removing container $container..." - docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" - done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do - echo "Removing image $image..." - docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" - done - - printf "Removing generated configs... \\U1F5D1 \\n" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - - printHeadline "Done! Network was purged" "U1F5D1" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Genesis file configuration (for solo and raft) - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_DB_TLS_ENABLED=false - - FABRIC_CA_SERVER_DB_TYPE=postgres - - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - depends_on: - db.ca.org1.example.com: - condition: service_healthy - networks: - - basic - - db.ca.org1.example.com: - container_name: db.ca.org1.example.com - image: postgres:\${FABRIC_CA_POSTGRES_VERSION} - environment: - - POSTGRES_PASSWORD=caDbPass12345 - - POSTGRES_USER=postgres - - POSTGRES_DB=fabriccaserver - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - fablo-rest.org1.example.com: - container_name: fablo-rest.org1.example.com - image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} - environment: - - PORT=8000 - - MSP_ID=Org1MSP - - FABRIC_CA_URL=https://ca.org1.example.com:7054 - - FABRIC_CA_NAME=ca.org1.example.com - - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 - - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - HFC_LOGGING={"error":"console","warn":"console","info":"console"} - volumes: - # note: fablo needs access to all anchor peer certs - - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro - ports: - - 8801:8000 - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - depends_on: - couchdb.peer0.org1.example.com: - condition: service_healthy - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: couchdb:\${COUCHDB_VERSION} - environment: - - COUCHDB_USER=peer0 - - COUCHDB_PASSWORD=peer0Password - healthcheck: - test: "curl -f http://localhost:5984/" - interval: 5s - timeout: 10s - retries: 7 - ports: - - 5100:5984 - networks: - - basic - - db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} - container_name: db.explorer.example.com - environment: - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWORD=password - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} - restart: on-failure:8 - container_name: explorer.example.com - environment: - - DATABASE_HOST=db.explorer.example.com - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWD=password - - LOG_LEVEL_APP=debug - - LOG_LEVEL_DB=debug - - LOG_LEVEL_CONSOLE=info - - LOG_CONSOLE_STDOUT=true - - DISCOVERY_AS_LOCALHOST=false - volumes: - - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json - - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile - - ../fabric-config/crypto-config:/tmp/crypto - ports: - - "7010:8080" - depends_on: - db.explorer.example.com: - condition: service_healthy - networks: - - basic - - peer0.org1.example.com_chaincode1: - container_name: peer0.org1.example.com_chaincode1 - image: ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0 - pull_policy: always - environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 - - CHAINCODE_ID=chaincode1:0.0.1 - ports: - - 7052:7052 - networks: - - basic -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -certsGenerate() { - local CONTAINER_NAME=certsGenerate - - local CONFIG_PATH=$1 - local CRYPTO_CONFIG_FILE_NAME=$2 - local ORG_PATH=$3 - local OUTPUT_PATH=$4 - local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH - - echo "Generating certs..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" - inputLog "ORG_PATH: $ORG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" - - if [ -d "$FULL_CERT_PATH" ]; then - echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME - - docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME - - # shellcheck disable=2044 - for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do - dir=$(dirname "$file") - mv "\${dir}"/*_sk "\${dir}"/priv-key.pem - done -} - -genesisBlockCreate() { - local CONTAINER_NAME=genesisBlockCreate - - local CONFIG_PATH=$1 - local OUTPUT_PATH=$2 - local GENESIS_PROFILE_NAME=$3 - local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block - - echo "Creating genesis block..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" - inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" - - if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then - echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME - - mkdir -p "$OUTPUT_PATH" - docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createChannelTx() { - local CONTAINER_NAME=createChannelTx - - local CHANNEL_NAME=$1 - local CONFIG_PATH=$2 - local CONFIG_PROFILE=$3 - local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx - - echo "Creating channelTx for $CHANNEL_NAME..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" - - if [ -f "$CHANNEL_TX_PATH" ]; then - echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createNewChannelUpdateTx() { - local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CONFIG_PROFILE=$3 - local CONFIG_PATH=$4 - local OUTPUT_PATH=$5 - - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then - echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen \\ - --configPath ./fabric-config \\ - -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ - -channelID "\${CHANNEL_NAME}" \\ - -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - - docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -notifyOrgAboutNewChannel() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -notifyOrgAboutNewChannelTls() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - local CA_CERT="/var/hyperledger/cli/"\${6} - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" \\ - --tls --cafile "$CA_CERT" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -deleteNewChannelUpdateTx() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" - inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -printHeadline() { - bold=$'\\e[1m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -printItalics() { - italics=$'\\e[3m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -inputLog() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -inputLogShort() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -certsRemove() { - local CERTS_DIR_PATH=$1 - rm -rf "$CERTS_DIR_PATH" -} - -removeContainer() { - CONTAINER_NAME=$1 - docker rm -f "$CONTAINER_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -printHelp() { - echo "Fablo is powered by SoftwareMill" - - echo "" - echo "usage: ./fabric-docker.sh " - echo "" - - echo "Commands: " - echo "" - echo "./fabric-docker.sh up" - echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." - echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" - echo "" - echo "./fabric-docker.sh down" - echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." - echo "" - echo "./fabric-docker.sh start" - echo -e "\\t Starts already created network." - echo "" - echo "./fabric-docker.sh stop" - echo -e "\\t Stops already running network." - echo "" - echo "./fabric-docker.sh reset" - echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." - echo "" - echo "./fabric-docker.sh channel --help" - echo -e "\\t Detailed help for channel management scripts." - echo "" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash -# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. -# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u - -dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" - fi -} - -node_version_check() { - - local fabric_shim_version="$1" - local nodejs_version - - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 - - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 - - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 - - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 - - else - nodejs_version=18.12 - fi - - echo $nodejs_version - -} - -chaincodeBuild() { - local CHAINCODE_NAME=$1 - local CHAINCODE_LANG=$2 - local CHAINCODE_DIR_PATH=$3 - local RECOMMENDED_NODE_VERSION=$4 - - mkdir -p "$CHAINCODE_DIR_PATH" - - # pull required images upfront in case of arm64 (Apple Silicon) architecture - # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately - # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly - if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then - if [ "$CHAINCODE_LANG" = "node" ]; then - dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "java" ]; then - dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "golang" ]; then - dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" - fi - fi - - if [ "$CHAINCODE_LANG" = "node" ]; then - NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") - RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") - - if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then - echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" - echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" - fi - - echo "Buiding chaincode '$CHAINCODE_NAME'..." - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" - inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - - # Default to using npm for installation and build - (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - - fi -} - -chaincodePackage() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodePackageCaas() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodeInstall() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CA_CERT=$5 - - echo "Installing chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA_CERT: $CA_CERT" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") - fi - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeApprove() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COLLECTIONS_CONFIG=\${10} - - echo "Approving chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYINSTALLED_RESPONSE - local CC_PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - if [ -z "$CC_PACKAGE_ID" ]; then - CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" - fi - inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --package-id "$CC_PACKAGE_ID" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeCommit() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COMMIT_PEER_ADDRESSES=\${10} - local TLS_ROOT_CERT_FILES=\${11} - local COLLECTIONS_CONFIG=\${12} - - echo "Committing chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" - inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local COMMIT_PEER_PARAMS=() - if [ -n "$COMMIT_PEER_ADDRESSES" ]; then - # shellcheck disable=SC2207 - COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) - fi - - local TLS_ROOT_CERT_PARAMS=() - if [ -n "$TLS_ROOT_CERT_FILES" ]; then - # shellcheck disable=SC2207 - TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ - "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -peerChaincodeList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - - # Execute the command to list chaincodes - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" -} - -peerChaincodeListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - local CA_CERT=$4 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CA_CERT: $CA_CERT" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" -} - -# Function to perform chaincode invoke -peerChaincodeInvoke() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - 2>&1 -} -# Function to perform chaincode invoke for Tls -peerChaincodeInvokeTls() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - local PEER_CERTS="$7" - local CA_CERT="$8" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - inputLog "PEER_CERTS: $PEER_CERTS" - inputLog "CA_CERT: $CA_CERT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - $TLS_ROOT_CERT_FILES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" \\ - 2>&1 -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -peerChannelList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list -} - -peerChannelGetInfo() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" -} - -peerChannelFetchConfig() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlock() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local TARGET_FILE="$5" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} - -#=== TLS equivalents ========================================================= - -peerChannelListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CA_CERT=$3 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" -} - -peerChannelGetInfoTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - local CA_CERT=$4 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" -} - -peerChannelFetchConfigTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - local CA_CERT=$5 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlockTls() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local CA_CERT="$5" - local TARGET_FILE="$6" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -createChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx - peer channel join -b "\${CHANNEL_NAME}".block - - rm -rf "$DIR_NAME" -} - -createChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" - peer channel join -b "\${CHANNEL_NAME}"_newest.block - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -__getOrdererAndPeerNodes() { - echo " - orderer0.group1.orderer.example.com - peer0.org1.example.com - " -} - -__getCASQLiteNodes() { - echo " - ca.orderer.example.com - " -} - -__getCAPostgresNodes() { - echo " - db.ca.org1.example.com - " -} - -__createSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" - - if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then - echo "Error: Directory '$backup_dir' already exists and is not empty!" - exit 1 - fi - - mkdir -p "$backup_dir" - cp -R ./fablo-target "$backup_dir/" - - for node in $(__getCASQLiteNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node" - docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" - done - - for node in $(__getCAPostgresNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node/pg-data" - docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Saving state of $node..." - docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" - done -} - -__cloneSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - target_dir="$1" - hook_cmd="$2" - - if [ -d "$target_dir/fablo-target" ]; then - echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." - exit 1 - fi - - cp -R ./fablo-target "$target_dir/fablo-target" - - if [ -n "$hook_cmd" ]; then - echo "Executing pre-restore hook: '$hook_cmd'" - (cd "$target_dir" && eval "$hook_cmd") - fi - - (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) - - for node in $(__getCASQLiteNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" - fi - done - - for node in $(__getCAPostgresNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" - fi - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/" "$node:/var/hyperledger/production/" - fi - done -} - -createSnapshot() { - (set -eu && __createSnapshot "$1") -} - -cloneSnapshot() { - (set -eu && __cloneSnapshot "$1" "$2") -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -# The code from this file was called after Fablo generated Hyperledger Fabric configuration -echo "Executing post-generate hook" - -perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -[ - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", -] -`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index da36e4563..20661ba31 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1792,19 +1792,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 267586c91..f12e61e72 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2587,51 +2587,51 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com_or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com_or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com_or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com_or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com_and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com_and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com_and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com_and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 91e26c7ff..f8bb1ce99 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3711,35 +3711,35 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org2.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org2.example.com_chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org2.example.com_chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index e45a1c347..04ce4a1d6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3969,19 +3969,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index b44b127d3..49fd933c6 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1858,19 +1858,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 383666036..4d5c5582e 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1882,19 +1882,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5427131118e21d1392b51fd9acd0255b8330e003 GIT binary patch literal 6148 zcmeHK%}T>S5T0$Trc|K^g&r5YR_u=o;w4ml0V8@)sf`I5jM>s8_D~8r>kIiLK94iI zTd`Cx9z@Cv%zm@8Gg;Z0 zXwzMSP+D{?76x$zMVM4XlPc^LLzr~*OB?4}EDV}-5PD~Pj@?<<8;a1oqhIQ95UxQU znE_^Co`JHN)~WxW{(S$RPvRLfzzi%E1EO-`o%FCI+glfkqh2dfZ&67ot}ytSf`)Fz g7)!0VfvN@lk_<%GVqp+HDEuR!Y2bkw_)`Wx0F-i0-v9sr literal 0 HcmV?d00001 diff --git a/src/setup-docker/.DS_Store b/src/setup-docker/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..39a4d421f40b4149b873e2a876ffef65df33988d GIT binary patch literal 6148 zcmeHK-AcnS6i&A3T87XIg;F&!<`6 zpWNW+QpzMK`+jg0N3)@`dnVJ|kJD(P65=p|klX7x4dtvar)ij}Tu(bJ+p>pFb3X5M zdo6L)=`C7fe$s8X#9{Avv9PVZ{e#ns;Zrh7<%_11!=I;Q$6yJs&{?yxXK#`wGJODV znOSBK5(C5lF|a8NnDftSY|4UZox}h!@M8w>d=Q|BuE9d1Iy#`i>m&MWh$zsU74{%P{XhTy{lA<fW7Xd{BHN?QLGVlQ@0!@Da literal 0 HcmV?d00001 diff --git a/src/setup-docker/templates/.DS_Store b/src/setup-docker/templates/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fc06ccfc8195e4f441fd6cf9e2a2344905f407c2 GIT binary patch literal 8196 zcmeHMU2GIp6h3EKV6IS^^4HGtla(qUEV^xN6&hjNZuzwVyDj|zS!Z_!I$=6fW@dMh zrrN|96Myh0`lyL9@xds82NR<4!2}JwXo7@j^uY)8!51{qXyS|K-a88}e-Fl}fw{@O zXU;w6%$;-QJNNFH1pw?RnXLfL0H9LmRGUk~bsCrReoa%NnR=o~_5d~%VLh1O5sh0M zfj9zj1mXz95r`x3e~bW~*}SPYIQOMA9^(ka5x6ZQ!1sqFbxt!8osm>*9W;m%fG95k zM5Ak}1B6X7qM3-!NGeR}p0awt$P}Xz1Eo31lU$u>CZaQvN^?MI4j8SBQH6qHb+Ste zb-;|I@fb%Sj=;4M;OWx<2f%;=_%-$WA+W$NRD#KZ;}uBjRAJJwgD{=GfJ$Bctl4wa zIqF>XvD~;<$%RH(3VIBGFXsk5&nZ-|jlv$=s^qmry`CEywrlyqz&0&X**9#vrdR3l zO0F3Q+nf}rOl5hkd1|V)tv!|OXlJGnYy^;{;q-iA!ow%o|8^t zv@wu3we5LgZ{nd7lzXLzb&0BnUsXM1Y_2{$GCG#mv{GOVSdJ0eWh-lhR*=``2juMb zqUY}Rtui?|T=bmMgiDgfqTv)vq-=FNPR>4R1tXz#B;;3Pf#-+4LUF_?87BHd_t_TLQk@N zCOv$=XYy4{Rr`PmNsFG;_i{?A`a+qdHvrhJqK3tBx)pp9sF7~iKQuHP!$i;v>NXhAp-lOm5D?efc;jT%`+TITtNrsgFB zIh`yt+b!FKXnF|}*xET&Ra-J^C9XtlTQX_MEvf|@omVR8kb+IH1;*$rmOMrm+>9BuURC{E!tK8erb%lHbuhOgtB_&y%T6L=Co#82@vJcDQP9A3ol z@dvzwKjF{#hf=RJDY}wSmMY7Xdz7_GyYxb-=Fr|+uaqqDH_xGHmrxF0FNYFawr<=0 zpXAWj^F-DxSh#5Mik3C&+d8{4m(eBRSViDpaV@}HlL7+F;>}-$LJlT9!Imwr=GT?X zl9@I{SzsMeIh3_Ik@j6HRmuWwR>ZDaP3%r>wqz6QQYvMfrU;fL(yfg0N~??5bsfZ_ zWY~s{j518CkJwF{8Bcl*1fNLsX6a6+wSNG-Z^6580#3nc0`CR*2EKz!1Xv)zYPdvz zb}25$Rk#}0;95*!2X^9vxPjoC#Xj7E+i(YgcaY#ajH6hS0KW;y4(j^`dEttz-{Z*UuPb<+1{UjO&q`1}8D z9HH3tI0CnR1h77v%l43;H`*b2t(~O)ICb8*-i)Nega%QL6BXq+(aV1r(shzlxlJab bGm_E_wSWCXKz#oHjUTV^`7gkF3k`n)c>FhW literal 0 HcmV?d00001 diff --git a/src/setup-docker/templates/fabric-docker/.DS_Store b/src/setup-docker/templates/fabric-docker/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9ebe8388648db94a3b7aa0b5b41a7b9698119a01 GIT binary patch literal 6148 zcmeHKIS#@=477m)L_?R^35$VGX6?4j=a->{24G^XjI_W3fuuhBNbi% literal 0 HcmV?d00001 diff --git a/src/setup-docker/templates/fabric-docker/core.yaml b/src/setup-docker/templates/fabric-docker/core.yaml deleted file mode 100644 index 7c3148143..000000000 --- a/src/setup-docker/templates/fabric-docker/core.yaml +++ /dev/null @@ -1,777 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################### -# -# Peer section -# -############################################################################### -peer: - - # The peer id provides a name for this peer instance and is used when - # naming docker resources. - id: jdoe - - # The networkId allows for logical separation of networks and is used when - # naming docker resources. - networkId: dev - - # The Address at local network interface this Peer will listen on. - # By default, it will listen on all network interfaces - listenAddress: 0.0.0.0:7051 - - # The endpoint this peer uses to listen for inbound chaincode connections. - # If this is commented-out, the listen address is selected to be - # the peer's address (see below) with port 7052 - # chaincodeListenAddress: 0.0.0.0:7052 - - # The endpoint the chaincode for this peer uses to connect to the peer. - # If this is not specified, the chaincodeListenAddress address is selected. - # And if chaincodeListenAddress is not specified, address is selected from - # peer address (see below). If specified peer address is invalid then it - # will fallback to the auto detected IP (local IP) regardless of the peer - # addressAutoDetect value. - # chaincodeAddress: 0.0.0.0:7052 - - # When used as peer config, this represents the endpoint to other peers - # in the same organization. For peers in other organization, see - # gossip.externalEndpoint for more info. - # When used as CLI config, this means the peer's endpoint to interact with - address: 0.0.0.0:7051 - - # Whether the Peer should programmatically determine its address - # This case is useful for docker containers. - # When set to true, will override peer address. - addressAutoDetect: false - - # Settings for the Peer's gateway server. - gateway: - # Whether the gateway is enabled for this Peer. - enabled: true - # endorsementTimeout is the duration the gateway waits for a response - # from other endorsing peers before returning a timeout error to the client. - endorsementTimeout: 30s - # dialTimeout is the duration the gateway waits for a connection - # to other network nodes. - dialTimeout: 2m - - - # Keepalive settings for peer server and clients - keepalive: - # Interval is the duration after which if the server does not see - # any activity from the client it pings the client to see if it's alive - interval: 7200s - # Timeout is the duration the server waits for a response - # from the client after sending a ping before closing the connection - timeout: 20s - # MinInterval is the minimum permitted time between client pings. - # If clients send pings more frequently, the peer server will - # disconnect them - minInterval: 60s - # Client keepalive settings for communicating with other peer nodes - client: - # Interval is the time between pings to peer nodes. This must - # greater than or equal to the minInterval specified by peer - # nodes - interval: 60s - # Timeout is the duration the client waits for a response from - # peer nodes before closing the connection - timeout: 20s - # DeliveryClient keepalive settings for communication with ordering - # nodes. - deliveryClient: - # Interval is the time between pings to ordering nodes. This must - # greater than or equal to the minInterval specified by ordering - # nodes. - interval: 60s - # Timeout is the duration the client waits for a response from - # ordering nodes before closing the connection - timeout: 20s - - - # Gossip related configuration - gossip: - # Bootstrap set to initialize gossip with. - # This is a list of other peers that this peer reaches out to at startup. - # Important: The endpoints here have to be endpoints of peers in the same - # organization, because the peer would refuse connecting to these endpoints - # unless they are in the same organization as the peer. - bootstrap: 127.0.0.1:7051 - - # NOTE: orgLeader and useLeaderElection parameters are mutual exclusive. - # Setting both to true would result in the termination of the peer - # since this is undefined state. If the peers are configured with - # useLeaderElection=false, make sure there is at least 1 peer in the - # organization that its orgLeader is set to true. - - # Defines whenever peer will initialize dynamic algorithm for - # "leader" selection, where leader is the peer to establish - # connection with ordering service and use delivery protocol - # to pull ledger blocks from ordering service. - useLeaderElection: false - # Statically defines peer to be an organization "leader", - # where this means that current peer will maintain connection - # with ordering service and disseminate block across peers in - # its own organization. Multiple peers or all peers in an organization - # may be configured as org leaders, so that they all pull - # blocks directly from ordering service. - orgLeader: true - - # Interval for membershipTracker polling - membershipTrackerInterval: 5s - - # Overrides the endpoint that the peer publishes to peers - # in its organization. For peers in foreign organizations - # see 'externalEndpoint' - endpoint: - # Maximum count of blocks stored in memory - maxBlockCountToStore: 10 - # Max time between consecutive message pushes(unit: millisecond) - maxPropagationBurstLatency: 10ms - # Max number of messages stored until a push is triggered to remote peers - maxPropagationBurstSize: 10 - # Number of times a message is pushed to remote peers - propagateIterations: 1 - # Number of peers selected to push messages to - propagatePeerNum: 3 - # Determines frequency of pull phases(unit: second) - # Must be greater than digestWaitTime + responseWaitTime - pullInterval: 4s - # Number of peers to pull from - pullPeerNum: 3 - # Determines frequency of pulling state info messages from peers(unit: second) - requestStateInfoInterval: 4s - # Determines frequency of pushing state info messages to peers(unit: second) - publishStateInfoInterval: 4s - # Maximum time a stateInfo message is kept until expired - stateInfoRetentionInterval: - # Time from startup certificates are included in Alive messages(unit: second) - publishCertPeriod: 10s - # Should we skip verifying block messages or not (currently not in use) - skipBlockVerification: false - # Dial timeout(unit: second) - dialTimeout: 3s - # Connection timeout(unit: second) - connTimeout: 2s - # Buffer size of received messages - recvBuffSize: 20 - # Buffer size of sending messages - sendBuffSize: 200 - # Time to wait before pull engine processes incoming digests (unit: second) - # Should be slightly smaller than requestWaitTime - digestWaitTime: 1s - # Time to wait before pull engine removes incoming nonce (unit: milliseconds) - # Should be slightly bigger than digestWaitTime - requestWaitTime: 1500ms - # Time to wait before pull engine ends pull (unit: second) - responseWaitTime: 2s - # Alive check interval(unit: second) - aliveTimeInterval: 5s - # Alive expiration timeout(unit: second) - aliveExpirationTimeout: 25s - # Reconnect interval(unit: second) - reconnectInterval: 25s - # Max number of attempts to connect to a peer - maxConnectionAttempts: 120 - # Message expiration factor for alive messages - msgExpirationFactor: 20 - # This is an endpoint that is published to peers outside of the organization. - # If this isn't set, the peer will not be known to other organizations. - externalEndpoint: - # Leader election service configuration - election: - # Longest time peer waits for stable membership during leader election startup (unit: second) - startupGracePeriod: 15s - # Interval gossip membership samples to check its stability (unit: second) - membershipSampleInterval: 1s - # Time passes since last declaration message before peer decides to perform leader election (unit: second) - leaderAliveThreshold: 10s - # Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second) - leaderElectionDuration: 5s - - pvtData: - # pullRetryThreshold determines the maximum duration of time private data corresponding for a given block - # would be attempted to be pulled from peers until the block would be committed without the private data - pullRetryThreshold: 60s - # As private data enters the transient store, it is associated with the peer's ledger's height at that time. - # transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit, - # and the private data residing inside the transient store that is guaranteed not to be purged. - # Private data is purged from the transient store when blocks with sequences that are multiples - # of transientstoreMaxBlockRetention are committed. - transientstoreMaxBlockRetention: 1000 - # pushAckTimeout is the maximum time to wait for an acknowledgement from each peer - # at private data push at endorsement time. - pushAckTimeout: 3s - # Block to live pulling margin, used as a buffer - # to prevent peer from trying to pull private data - # from peers that is soon to be purged in next N blocks. - # This helps a newly joined peer catch up to current - # blockchain height quicker. - btlPullMargin: 10 - # the process of reconciliation is done in an endless loop, while in each iteration reconciler tries to - # pull from the other peers the most recent missing blocks with a maximum batch size limitation. - # reconcileBatchSize determines the maximum batch size of missing private data that will be reconciled in a - # single iteration. - reconcileBatchSize: 10 - # reconcileSleepInterval determines the time reconciler sleeps from end of an iteration until the beginning - # of the next reconciliation iteration. - reconcileSleepInterval: 1m - # reconciliationEnabled is a flag that indicates whether private data reconciliation is enable or not. - reconciliationEnabled: true - # skipPullingInvalidTransactionsDuringCommit is a flag that indicates whether pulling of invalid - # transaction's private data from other peers need to be skipped during the commit time and pulled - # only through reconciler. - skipPullingInvalidTransactionsDuringCommit: false - # implicitCollectionDisseminationPolicy specifies the dissemination policy for the peer's own implicit collection. - # When a peer endorses a proposal that writes to its own implicit collection, below values override the default values - # for disseminating private data. - # Note that it is applicable to all channels the peer has joined. The implication is that requiredPeerCount has to - # be smaller than the number of peers in a channel that has the lowest numbers of peers from the organization. - implicitCollectionDisseminationPolicy: - # requiredPeerCount defines the minimum number of eligible peers to which the peer must successfully - # disseminate private data for its own implicit collection during endorsement. Default value is 0. - requiredPeerCount: 0 - # maxPeerCount defines the maximum number of eligible peers to which the peer will attempt to - # disseminate private data for its own implicit collection during endorsement. Default value is 1. - maxPeerCount: 1 - - # Gossip state transfer related configuration - state: - # indicates whenever state transfer is enabled or not - # default value is false, i.e. state transfer is active - # and takes care to sync up missing blocks allowing - # lagging peer to catch up to speed with rest network. - # Keep in mind that when peer.gossip.useLeaderElection is true - # and there are several peers in the organization, - # or peer.gossip.useLeaderElection is false alongside with - # peer.gossip.orgleader being false, the peer's ledger may lag behind - # the rest of the peers and will never catch up due to state transfer - # being disabled. - enabled: false - # checkInterval interval to check whether peer is lagging behind enough to - # request blocks via state transfer from another peer. - checkInterval: 10s - # responseTimeout amount of time to wait for state transfer response from - # other peers - responseTimeout: 3s - # batchSize the number of blocks to request via state transfer from another peer - batchSize: 10 - # blockBufferSize reflects the size of the re-ordering buffer - # which captures blocks and takes care to deliver them in order - # down to the ledger layer. The actual buffer size is bounded between - # 0 and 2*blockBufferSize, each channel maintains its own buffer - blockBufferSize: 20 - # maxRetries maximum number of re-tries to ask - # for single state transfer request - maxRetries: 3 - - # TLS Settings - tls: - # Require server-side TLS - enabled: false - # Require client certificates / mutual TLS for inbound connections. - # Note that clients that are not configured to use a certificate will - # fail to connect to the peer. - clientAuthRequired: false - # X.509 certificate used for TLS server - cert: - file: tls/server.crt - # Private key used for TLS server - key: - file: tls/server.key - # rootcert.file represents the trusted root certificate chain used for verifying certificates - # of other nodes during outbound connections. - # It is not required to be set, but can be used to augment the set of TLS CA certificates - # available from the MSPs of each channel’s configuration. - rootcert: - file: tls/ca.crt - # If mutual TLS is enabled, clientRootCAs.files contains a list of additional root certificates - # used for verifying certificates of client connections. - # It augments the set of TLS CA certificates available from the MSPs of each channel’s configuration. - # Minimally, set your organization's TLS CA root certificate so that the peer can receive join channel requests. - clientRootCAs: - files: - - tls/ca.crt - # Private key used for TLS when making client connections. - # If not set, peer.tls.key.file will be used instead - clientKey: - file: - # X.509 certificate used for TLS when making client connections. - # If not set, peer.tls.cert.file will be used instead - clientCert: - file: - - # Authentication contains configuration parameters related to authenticating - # client messages - authentication: - # the acceptable difference between the current server time and the - # client's time as specified in a client request message - timewindow: 15m - - # Path on the file system where peer will store data (eg ledger). This - # location must be access control protected to prevent unintended - # modification that might corrupt the peer operations. - fileSystemPath: /var/hyperledger/production - - # BCCSP (Blockchain crypto provider): Select which crypto implementation or - # library to use - BCCSP: - Default: SW - # Settings for the SW crypto provider (i.e. when DEFAULT: SW) - SW: - # TODO: The default Hash and Security level needs refactoring to be - # fully configurable. Changing these defaults requires coordination - # SHA2 is hardcoded in several places, not only BCCSP - Hash: SHA2 - Security: 256 - # Location of Key Store - FileKeyStore: - # If "", defaults to 'mspConfigPath'/keystore - KeyStore: - # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11) - PKCS11: - # Location of the PKCS11 module library - Library: - # Token Label - Label: - # User PIN - Pin: - Hash: - Security: - - # Path on the file system where peer will find MSP local configurations - mspConfigPath: msp - # Identifier of the local MSP - # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!---- - # Deployers need to change the value of the localMspId string. - # In particular, the name of the local MSP ID of a peer needs - # to match the name of one of the MSPs in each of the channel - # that this peer is a member of. Otherwise this peer's messages - # will not be identified as valid by other nodes. - localMspId: SampleOrg - - # CLI common client config options - client: - # connection timeout - connTimeout: 3s - - # Delivery service related config - deliveryclient: - # Enables this peer to disseminate blocks it pulled from the ordering service - # via gossip. - # Note that 'gossip.state.enabled' controls point to point block replication - # of blocks committed in the past. - blockGossipEnabled: true - # It sets the total time the delivery service may spend in reconnection - # attempts until its retry logic gives up and returns an error - reconnectTotalTimeThreshold: 3600s - - # It sets the delivery service <-> ordering service node connection timeout - connTimeout: 3s - - # It sets the delivery service maximal delay between consecutive retries - reConnectBackoffThreshold: 3600s - - # A list of orderer endpoint addresses which should be overridden - # when found in channel configurations. - addressOverrides: - # - from: - # to: - # caCertsFile: - # - from: - # to: - # caCertsFile: - - # Type for the local MSP - by default it's of type bccsp - localMspType: bccsp - - # Used with Go profiling tools only in none production environment. In - # production, it should be disabled (eg enabled: false) - profile: - enabled: false - listenAddress: 0.0.0.0:6060 - - # Handlers defines custom handlers that can filter and mutate - # objects passing within the peer, such as: - # Auth filter - reject or forward proposals from clients - # Decorators - append or mutate the chaincode input passed to the chaincode - # Endorsers - Custom signing over proposal response payload and its mutation - # Valid handler definition contains: - # - A name which is a factory method name defined in - # core/handlers/library/library.go for statically compiled handlers - # - library path to shared object binary for pluggable filters - # Auth filters and decorators are chained and executed in the order that - # they are defined. For example: - # authFilters: - # - - # name: FilterOne - # library: /opt/lib/filter.so - # - - # name: FilterTwo - # decorators: - # - - # name: DecoratorOne - # - - # name: DecoratorTwo - # library: /opt/lib/decorator.so - # Endorsers are configured as a map that its keys are the endorsement system chaincodes that are being overridden. - # Below is an example that overrides the default ESCC and uses an endorsement plugin that has the same functionality - # as the default ESCC. - # If the 'library' property is missing, the name is used as the constructor method in the builtin library similar - # to auth filters and decorators. - # endorsers: - # escc: - # name: DefaultESCC - # library: /etc/hyperledger/fabric/plugin/escc.so - handlers: - authFilters: - - - name: DefaultAuth - - - name: ExpirationCheck # This filter checks identity x509 certificate expiration - decorators: - - - name: DefaultDecorator - endorsers: - escc: - name: DefaultEndorsement - library: - validators: - vscc: - name: DefaultValidation - library: - - # library: /etc/hyperledger/fabric/plugin/escc.so - # Number of goroutines that will execute transaction validation in parallel. - # By default, the peer chooses the number of CPUs on the machine. Set this - # variable to override that choice. - # NOTE: overriding this value might negatively influence the performance of - # the peer so please change this value only if you know what you're doing - validatorPoolSize: - - # The discovery service is used by clients to query information about peers, - # such as - which peers have joined a certain channel, what is the latest - # channel config, and most importantly - given a chaincode and a channel, - # what possible sets of peers satisfy the endorsement policy. - discovery: - enabled: true - # Whether the authentication cache is enabled or not. - authCacheEnabled: true - # The maximum size of the cache, after which a purge takes place - authCacheMaxSize: 1000 - # The proportion (0 to 1) of entries that remain in the cache after the cache is purged due to overpopulation - authCachePurgeRetentionRatio: 0.75 - # Whether to allow non-admins to perform non channel scoped queries. - # When this is false, it means that only peer admins can perform non channel scoped queries. - orgMembersAllowedAccess: false - - # Limits is used to configure some internal resource limits. - limits: - # Concurrency limits the number of concurrently running requests to a service on each peer. - # Currently this option is only applied to endorser service and deliver service. - # When the property is missing or the value is 0, the concurrency limit is disabled for the service. - concurrency: - # endorserService limits concurrent requests to endorser service that handles chaincode deployment, query and invocation, - # including both user chaincodes and system chaincodes. - endorserService: 2500 - # deliverService limits concurrent event listeners registered to deliver service for blocks and transaction events. - deliverService: 2500 - - # Since all nodes should be consistent it is recommended to keep - # the default value of 100MB for MaxRecvMsgSize & MaxSendMsgSize - # Max message size in bytes GRPC server and client can receive - maxRecvMsgSize: 104857600 - # Max message size in bytes GRPC server and client can send - maxSendMsgSize: 104857600 - -############################################################################### -# -# VM section -# -############################################################################### -vm: - - # Endpoint of the vm management system. For docker can be one of the following in general - # unix:///var/run/docker.sock - # http://localhost:2375 - # https://localhost:2376 - # If you utilize external chaincode builders and don't need the default Docker chaincode builder, - # the endpoint should be unconfigured so that the peer's Docker health checker doesn't get registered. - endpoint: unix:///var/run/docker.sock - - # settings for docker vms - docker: - tls: - enabled: false - ca: - file: docker/ca.crt - cert: - file: docker/tls.crt - key: - file: docker/tls.key - - # Enables/disables the standard out/err from chaincode containers for - # debugging purposes - attachStdout: false - - # Parameters on creating docker container. - # Container may be efficiently created using ipam & dns-server for cluster - # NetworkMode - sets the networking mode for the container. Supported - # standard values are: `host`(default),`bridge`,`ipvlan`,`none`. - # Dns - a list of DNS servers for the container to use. - # Note: `Privileged` `Binds` `Links` and `PortBindings` properties of - # Docker Host Config are not supported and will not be used if set. - # LogConfig - sets the logging driver (Type) and related options - # (Config) for Docker. For more info, - # https://docs.docker.com/engine/admin/logging/overview/ - # Note: Set LogConfig using Environment Variables is not supported. - hostConfig: - NetworkMode: host - Dns: - # - 192.168.0.1 - LogConfig: - Type: json-file - Config: - max-size: "50m" - max-file: "5" - Memory: 2147483648 - -############################################################################### -# -# Chaincode section -# -############################################################################### -chaincode: - - # The id is used by the Chaincode stub to register the executing Chaincode - # ID with the Peer and is generally supplied through ENV variables - # the `path` form of ID is provided when installing the chaincode. - # The `name` is used for all other requests and can be any string. - id: - path: - name: - - # Generic builder environment, suitable for most chaincode types - builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION) - - # Enables/disables force pulling of the base docker images (listed below) - # during user chaincode instantiation. - # Useful when using moving image tags (such as :latest) - pull: false - - golang: - # golang will never need more than baseos - runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION) - - # whether or not golang chaincode should be linked dynamically - dynamicLink: false - - java: - # This is an image based on java:openjdk-8 with addition compiler - # tools added for java shim layer packaging. - # This image is packed with shim layer libraries that are necessary - # for Java chaincode runtime. - runtime: $(DOCKER_NS)/fabric-javaenv:2.5 - - node: - # This is an image based on node:$(NODE_VER)-alpine - runtime: $(DOCKER_NS)/fabric-nodeenv:2.5 - - # List of directories to treat as external builders and launchers for - # chaincode. The external builder detection processing will iterate over the - # builders in the order specified below. - # If you don't need to fallback to the default Docker builder, also unconfigure vm.endpoint above. - # To override this property via env variable use CORE_CHAINCODE_EXTERNALBUILDERS: [{name: x, path: dir1}, {name: y, path: dir2}] - externalBuilders: - - name: ccaas_builder - path: /opt/hyperledger/ccaas_builder - propagateEnvironment: - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG - - - # The maximum duration to wait for the chaincode build and install process - # to complete. - installTimeout: 300s - - # Timeout duration for starting up a container and waiting for Register - # to come through. - startuptimeout: 300s - - # Timeout duration for Invoke and Init calls to prevent runaway. - # This timeout is used by all chaincodes in all the channels, including - # system chaincodes. - # Note that during Invoke, if the image is not available (e.g. being - # cleaned up when in development environment), the peer will automatically - # build the image, which might take more time. In production environment, - # the chaincode image is unlikely to be deleted, so the timeout could be - # reduced accordingly. - executetimeout: 30s - - # There are 2 modes: "dev" and "net". - # In dev mode, user runs the chaincode after starting peer from - # command line on local machine. - # In net mode, peer will run chaincode in a docker container. - mode: net - - # keepalive in seconds. In situations where the communication goes through a - # proxy that does not support keep-alive, this parameter will maintain connection - # between peer and chaincode. - # A value <= 0 turns keepalive off - keepalive: 0 - - # enabled system chaincodes - system: - _lifecycle: enable - cscc: enable - lscc: enable - qscc: enable - - # Logging section for the chaincode container - logging: - # Default level for all loggers within the chaincode container - level: info - # Override default level for the 'shim' logger - shim: warning - # Format for the chaincode container logs - format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' - -############################################################################### -# -# Ledger section - ledger configuration encompasses both the blockchain -# and the state -# -############################################################################### -ledger: - - blockchain: - - state: - # stateDatabase - options are "goleveldb", "CouchDB" - # goleveldb - default state database stored in goleveldb. - # CouchDB - store state database in CouchDB - stateDatabase: goleveldb - # Limit on the number of records to return per query - totalQueryLimit: 100000 - couchDBConfig: - # It is recommended to run CouchDB on the same server as the peer, and - # not map the CouchDB container port to a server port in docker-compose. - # Otherwise proper security must be provided on the connection between - # CouchDB client (on the peer) and server. - couchDBAddress: 127.0.0.1:5984 - # This username must have read and write authority on CouchDB - username: - # The password is recommended to pass as an environment variable - # during start up (eg CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD). - # If it is stored here, the file must be access control protected - # to prevent unintended users from discovering the password. - password: - # Number of retries for CouchDB errors - maxRetries: 3 - # Number of retries for CouchDB errors during peer startup. - # The delay between retries doubles for each attempt. - # Default of 10 retries results in 11 attempts over 2 minutes. - maxRetriesOnStartup: 10 - # CouchDB request timeout (unit: duration, e.g. 20s) - requestTimeout: 35s - # Limit on the number of records per each CouchDB query - # Note that chaincode queries are only bound by totalQueryLimit. - # Internally the chaincode may execute multiple CouchDB queries, - # each of size internalQueryLimit. - internalQueryLimit: 1000 - # Limit on the number of records per CouchDB bulk update batch - maxBatchUpdateSize: 1000 - # Create the _global_changes system database - # This is optional. Creating the global changes database will require - # additional system resources to track changes and maintain the database - createGlobalChangesDB: false - # CacheSize denotes the maximum mega bytes (MB) to be allocated for the in-memory state - # cache. Note that CacheSize needs to be a multiple of 32 MB. If it is not a multiple - # of 32 MB, the peer would round the size to the next multiple of 32 MB. - # To disable the cache, 0 MB needs to be assigned to the cacheSize. - cacheSize: 64 - - history: - # enableHistoryDatabase - options are true or false - # Indicates if the history of key updates should be stored. - # All history 'index' will be stored in goleveldb, regardless if using - # CouchDB or alternate database for the state. - enableHistoryDatabase: true - - pvtdataStore: - # the maximum db batch size for converting - # the ineligible missing data entries to eligible missing data entries - collElgProcMaxDbBatchSize: 5000 - # the minimum duration (in milliseconds) between writing - # two consecutive db batches for converting the ineligible missing data entries to eligible missing data entries - collElgProcDbBatchesInterval: 1000 - # The missing data entries are classified into two categories: - # (1) prioritized - # (2) deprioritized - # Initially, all missing data are in the prioritized list. When the - # reconciler is unable to fetch the missing data from other peers, - # the unreconciled missing data would be moved to the deprioritized list. - # The reconciler would retry deprioritized missing data after every - # deprioritizedDataReconcilerInterval (unit: minutes). Note that the - # interval needs to be greater than the reconcileSleepInterval - deprioritizedDataReconcilerInterval: 60m - - snapshots: - # Path on the file system where peer will store ledger snapshots - rootDir: /var/hyperledger/production/snapshots - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # most operations service endpoints require client authentication when TLS - # is enabled. clientAuthRequired requires client certificate authentication - # at the TLS layer to access all resources. - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # metrics provider is one of statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: \ No newline at end of file From 3f22ae9b7a2f4f591a9bc870a31ddb25d360ac63 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Fri, 6 Jun 2025 11:15:01 -0500 Subject: [PATCH 083/471] fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan --- src/setup-docker/templates/.DS_Store | Bin 8196 -> 8196 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/setup-docker/templates/.DS_Store b/src/setup-docker/templates/.DS_Store index fc06ccfc8195e4f441fd6cf9e2a2344905f407c2..ed8c70bd1de70c738a6eee376e0e1063ede3eca5 100644 GIT binary patch delta 1078 zcmd^7Nlz3(7_B$5RJlMAhXHIlLRcb;XhZ`jAP9;JOAL$*NWdPtkc!YF(>;TFa5TZF zi5ktsqf0dLXe7qOsNuvxH1Pm)^rVR=6E0lTxYSHT_z_;J^S!U$>#yGXW?E)iUR38m zi|@?29b;^(w?8Uv8JrLUhCM1QQ(9;J)6#Ut2c;=2M~+DmW-JH8eU>pP65N-UU$9Nn z+&k->HI+alD5oOQxyVZ>O>D`^=1eOpW|Y4gG7U#`h0LU)nd)dUt*DIB)5%6#Sg6y* znO0G$7)GBhF9}zJ)$C%7+kNMxwaR6+dnx0lf5Hfg30IEQHz?>te^i8R8M0Qvre>t%Ddq16?QtV4dZsNAUL|#OQaZx3 zQ+See*pyBvoHC`mNYe(AVy&hrO!fABUmn+bH9zHxio>N9m5$-4xq8(nV$+hA%J@od zbL;_mMxK+`WR5J559A~HM3%^B@`ZdSE95u%3j$yxHeoZeprI6HD90WgKqH!P5bfwf zH+paqr!ayuFfa;hkR6hc?_>_7#oP>p@4Lp}B@v)XY49XN*L=!IWd6~F+3Fd;C85T=x2 d4kF5~E4YdoT*DpQ#XZDdKK0FJ{Pz|Z_y?KT29*E+ delta 1038 zcmd^-%}Z2K7{<>tS)CJ@XGmw}Tq`U?OQ+C6%Oo39D>N~5CO;D8j`!Le(mOi$j+Rjq zWVGsYYFV40U7Bw|sChUjE z?)G2L_}M1bCk@kb0#m%zAc6 z^b93OM^#2!MF@L#L>v(VMn*k)LbsicG1GGAdhHck#4*ulC-jurF=?48%I7@4Rr!Ow zAXjnQS`6tVQ)=iOloD~0(q1=BqhXlFVtz0b=QYDA<_nb4(nv*i zrKllupFAS7T*EEg#$DXQ13bnP%wQJJ@dj@(hj}busSuy>1a$3`xnrWWe49_kX_4I=% z6dZvZj$&*<8OpH}6$qmSwb+k31*RD-IEv$FRal}5OgDNF#}Et!Cy6nP!$w-6$>1`s V;3{t5rh;_m>BGS6y8kM!jz8=P^=kkC From 57ec5be34737c9a8b3adae43e79907ce9d7c31e6 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 28 Apr 2025 18:41:06 +0200 Subject: [PATCH 084/471] Fix tag format for release CI (#504) From 643c813f1a792036d8e7163e00baeab3d01f7a67 Mon Sep 17 00:00:00 2001 From: Kalio <89003403+kalio007@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:47:51 +0100 Subject: [PATCH 085/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8c8e638a71d9a67a8a9e9211b19a979998e229c1 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:43 -0500 Subject: [PATCH 086/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8d27d6339b0c252ef181f2aafe2c32404a6836d5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:46 -0500 Subject: [PATCH 087/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8f65c0b3eb37cdb344230b53eb8b331b1dee2f44 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:50 -0500 Subject: [PATCH 088/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a409150423009d732adc823250ba6ec0b10d9ac4 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:51 -0500 Subject: [PATCH 089/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3daa59aaa11e090b44eb3cdfd70c8aca72183bed Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:53 -0500 Subject: [PATCH 090/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 590dcae97daa4409fba022f85b4402085ffd82d9 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:54 -0500 Subject: [PATCH 091/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From afef4d806c4affafe9fd324bc896199f947a0127 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:54 -0500 Subject: [PATCH 092/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5092af05dd38b2386d303976735b58df39d96bb5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:55 -0500 Subject: [PATCH 093/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ddb80030ee5d339192964e5a04880426dcb28a88 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:56 -0500 Subject: [PATCH 094/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 61441ba5cedb9c38e533641cf83b08b8b760a780 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:57 -0500 Subject: [PATCH 095/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 78ba494ab9d90e6a6cf04e2a28c7851b58cf9682 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:58 -0500 Subject: [PATCH 096/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3575f5d0bb4c26e67c2fb4c20702e9b93b1543e9 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:59 -0500 Subject: [PATCH 097/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 97ad747f47070dc0a56ed2db6b507f2c9c7a3b26 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:01 -0500 Subject: [PATCH 098/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e55da6e888fb11a4cc7a0c587b336caf818f34ac Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:02 -0500 Subject: [PATCH 099/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b0e7beddd90df5ac90da29cceade6c4fe4dd6bf2 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:03 -0500 Subject: [PATCH 100/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6030223925a9d832ada7e37b21d5e112b5795a07 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:04 -0500 Subject: [PATCH 101/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0c05034cdd3fa3a139600195fbe9f710c669dc88 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:05 -0500 Subject: [PATCH 102/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 775a1d82ab0c70ccf07d8b0fe1acaee740018015 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:06 -0500 Subject: [PATCH 103/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3404be5dd5227fc5756f4d97d483a6d3500ce2bb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:06 -0500 Subject: [PATCH 104/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0fb6676373d1a6c208054ae3e474f3f60c279811 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:07 -0500 Subject: [PATCH 105/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f1f0d8f406876834b0685c70c8561f38f33a715b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:08 -0500 Subject: [PATCH 106/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e8a6a48a8ac8b291f52c6ac608088ced057b32b5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:09 -0500 Subject: [PATCH 107/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 01f2485f11f469d65ccaf08006659ea9e2c56a89 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:10 -0500 Subject: [PATCH 108/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f647127bbb87e8b8ed61835639013f73b5fa56ce Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:11 -0500 Subject: [PATCH 109/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 590ee1591e27065416bd56141af66b079d1722d4 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:11 -0500 Subject: [PATCH 110/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 94e94d9622f65d2016f9e6bdd30471274829b57a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:12 -0500 Subject: [PATCH 111/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 02d0be3d4564539ea52a4eeb2b75a2e5308f7a9c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:14 -0500 Subject: [PATCH 112/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f55b93c0ac07f167c40cd6c60d78c3e4720ce169 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:15 -0500 Subject: [PATCH 113/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 4232ec769b3ed3c6478f3f714309cdb1104b9056 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:15 -0500 Subject: [PATCH 114/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6159661958c0b47e98e8a6ac7721c7c3f4a374a0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:16 -0500 Subject: [PATCH 115/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f7e8d8635fc79cd9c48aa4b8180ffa95ac4bb24f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:17 -0500 Subject: [PATCH 116/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ca4523a2db42d2d2aee80e2b92fb71d7de803b45 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:17 -0500 Subject: [PATCH 117/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b782f78b7dbc6133573e34c34cc004fe898d842a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:19 -0500 Subject: [PATCH 118/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From bd0a914b06653d030868bed22c1ab73ee7dcef12 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:20 -0500 Subject: [PATCH 119/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9b809862c626b8edf9b716673adb80222e132095 Mon Sep 17 00:00:00 2001 From: Ronald L <35465493+ronaldl29@users.noreply.github.com> Date: Wed, 30 Apr 2025 12:10:42 -0400 Subject: [PATCH 120/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 57d8c2b8bd8ae168fc9b6ca3d205e52b8042a5b5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:59 -0500 Subject: [PATCH 121/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 444e774acd356d7e80aeac717813fb2f6b53e17a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:03 -0500 Subject: [PATCH 122/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d2a5b2b87d3f3473410b2b8cda73aad9f8068bb0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:05 -0500 Subject: [PATCH 123/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ca8b9bb8bee2dc1c768c3bc5da71a98636e007fe Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:06 -0500 Subject: [PATCH 124/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 1d414ef180f93c3ab88a9658f57b6f8a9644761d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:07 -0500 Subject: [PATCH 125/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 67263dbe3dcd2b5e65fc3a20743716461ecc3ef8 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:08 -0500 Subject: [PATCH 126/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9720a2b34b63e59285a5ed511bd8e7fe0fda0c45 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:09 -0500 Subject: [PATCH 127/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ba5729bb9b5567e5603f333d16313bc63228cc3e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:10 -0500 Subject: [PATCH 128/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c4c93377ba4d5d341225c32f33d2914e1e3c2e25 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:11 -0500 Subject: [PATCH 129/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 86423690b5e73db3502067428932fb4cf2ea3fec Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:12 -0500 Subject: [PATCH 130/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5ce5fda7b1c2986010b38a702e5c3f3e37a5cb3c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:13 -0500 Subject: [PATCH 131/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 65391c1b53c136d7080534cbba6d786f277c2828 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:14 -0500 Subject: [PATCH 132/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 89790e81464fe292c56c590e8440a12a25f5895c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:15 -0500 Subject: [PATCH 133/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From bd08e4a922d4de569f4c25c28bdbe98253969224 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:16 -0500 Subject: [PATCH 134/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 7cdd7d888c075848843d2dac8f2f9a55364f3fdc Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:17 -0500 Subject: [PATCH 135/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 24055ff519cb105dbfd9a809cadc66233e5c8e8f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:17 -0500 Subject: [PATCH 136/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b51b6785e4860399ee29875b36c153e0ca2bae16 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:18 -0500 Subject: [PATCH 137/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3a3968566ade0f041b18ac49c609829b739a9d53 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:19 -0500 Subject: [PATCH 138/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 4a4990c4a0f72e7160b61281dfb63b0e2f413d5c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:19 -0500 Subject: [PATCH 139/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d2f5bce3bf24bf0bf9e8510c1b2de543f30ae8c9 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:21 -0500 Subject: [PATCH 140/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c6141f3099c77ef9b7d9945d3422bd104cfe338c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:22 -0500 Subject: [PATCH 141/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f7a72095a56f0ed2eca2dcc7631b9136a9acb4cb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:23 -0500 Subject: [PATCH 142/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 80e8db10e8b71a4a9a94a17174a9904acb0d7499 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:24 -0500 Subject: [PATCH 143/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5408205853269b38b149a1c0eb3a48b753032efb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:25 -0500 Subject: [PATCH 144/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9edb50b73510464f549ab7bf70cea284ce099444 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:26 -0500 Subject: [PATCH 145/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9ca8d3abc356778f568a96050a01496227096ae0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:28 -0500 Subject: [PATCH 146/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From de86be91aa03295eeb33c0cf1a6c6d2b6f8d1ca8 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:29 -0500 Subject: [PATCH 147/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 522eafea76898ce1d5ff7a22544ac51d7a2fb4ce Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:30 -0500 Subject: [PATCH 148/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f3be25152abb7bb60b33e0d206544008b44beee8 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:31 -0500 Subject: [PATCH 149/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5044ccc59a81d14b890fb1fc13c7457883057a1f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:32 -0500 Subject: [PATCH 150/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From edb0165163d261c0913101145d022dc592b1ac2f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:34 -0500 Subject: [PATCH 151/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 806bb3009c52bebacbccbde16bab5efd5426fcf5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:35 -0500 Subject: [PATCH 152/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f6737a1c8e68783693d1c10347aad94d1743909b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:48 -0500 Subject: [PATCH 153/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 39681e52ba48c1663d9be67fc2910503067e1598 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:55 -0500 Subject: [PATCH 154/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 7c7553aecd79a09e43a5fb559dd728fe3482a021 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:57 -0500 Subject: [PATCH 155/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 2cd51a73e58dd66c63b7dc2b5aec29ef6d045197 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:59 -0500 Subject: [PATCH 156/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0191b5b9146548e9f4fb2b8f54517ed0485043bc Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:03 -0500 Subject: [PATCH 157/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 296ca6b43f1b8cd1a8a8803104269bb655d4d700 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:06 -0500 Subject: [PATCH 158/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6b501ad84377543dba3b468453ba7aba03ffe27d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:08 -0500 Subject: [PATCH 159/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8932caac4391df604f5d27d894c1ae0dd56a383f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:09 -0500 Subject: [PATCH 160/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 10cb27916e1da1bae0a3573a53f059df045ea9da Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:10 -0500 Subject: [PATCH 161/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0af2118b4c4d7da9346a567227b28c21ed0bd284 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:12 -0500 Subject: [PATCH 162/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a87c78da304ded60f09708e7ca86f135ca559aa4 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:13 -0500 Subject: [PATCH 163/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d86f70358cc9913a5f89535383838118ebd535e3 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:14 -0500 Subject: [PATCH 164/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b229b14f4028f4999ad618cfc13f6b80cfb4321d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:15 -0500 Subject: [PATCH 165/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ad31d4fde3e5884d6a34025f593826ceec7a34db Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:16 -0500 Subject: [PATCH 166/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a6bf1958008a3e7eca2d60036ef822e81d000d2d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:17 -0500 Subject: [PATCH 167/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 773ea2a0b4a76cc1e4bc59bbc9e479ce55b67008 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:18 -0500 Subject: [PATCH 168/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0c60880f522bbc21407919f089c97639a6f654eb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:20 -0500 Subject: [PATCH 169/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d3254fd0922f2ac29e5c577372e6be1a7990f21c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:21 -0500 Subject: [PATCH 170/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From fcc27cc547966e4fc92fd49c03909324d2fdc736 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:22 -0500 Subject: [PATCH 171/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 431456a79e4cd097d8684d1fa29911e3d5b7411f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:15 -0500 Subject: [PATCH 172/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 99d41e893cddcba19ee5f011a06c2238ebebd3ea Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:17 -0500 Subject: [PATCH 173/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 344d8267389b0908c76c657d9995f038fe02b777 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:18 -0500 Subject: [PATCH 174/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5b894be655efc3b9d29bb85919ec145d98d16f37 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:19 -0500 Subject: [PATCH 175/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f044053a1c6ba027816a5399ee536246fe923e14 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:19 -0500 Subject: [PATCH 176/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From dbe43c6bafd6a511c988543d6dce9517198e8f18 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:20 -0500 Subject: [PATCH 177/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8c6c88c7ac09394d27b9851ad3cdcc0dfe1f11e4 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:21 -0500 Subject: [PATCH 178/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3d211da672baed0504ac53dd636dcb1366d54504 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:22 -0500 Subject: [PATCH 179/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8765a73791f5a3bb2d3fd15701a2810913677cad Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:23 -0500 Subject: [PATCH 180/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e5081581dc2a77bd370509fddecf58e55bcd282f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:24 -0500 Subject: [PATCH 181/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 54b13d3b75fc8d8c8bb48434ff50f242c37dec64 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:24 -0500 Subject: [PATCH 182/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b2ae46a1b6fe4b89a92ae6d56f24484df4deb2a0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:25 -0500 Subject: [PATCH 183/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b3d09c59fa4fae312d3979c6099a3fe5b5822153 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:26 -0500 Subject: [PATCH 184/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 4131b7b99ad856ed49b6b114d1d10f6af67a86f8 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:27 -0500 Subject: [PATCH 185/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 7c00c0d91d7bfa58f8026508b4cb34746499c8a5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:28 -0500 Subject: [PATCH 186/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 71d2f7633396d85111110996c2f5a448f0683f04 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:29 -0500 Subject: [PATCH 187/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9920cb2da9c3c261e51f85b478c64f2795196749 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:30 -0500 Subject: [PATCH 188/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 7c3d2babd14597ab697eed2d33235318979e8855 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:30 -0500 Subject: [PATCH 189/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 46cd0efda122856647c6a0e6052c01e12cafe9d0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:31 -0500 Subject: [PATCH 190/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 49117fac0ec54ce87c7322415fa0de89cc87d818 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:32 -0500 Subject: [PATCH 191/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From cdece907a090786cbb7f5a386560932cd157de36 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:33 -0500 Subject: [PATCH 192/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3728cd48f8ebc06b8cb4f9b4e683f05edb48b6db Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:34 -0500 Subject: [PATCH 193/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e0b2559b2da6937aa3e85bab95eb4642a54e1b23 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:35 -0500 Subject: [PATCH 194/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 634dadf5bddc08b79294c12ed30f24eb300b447b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:36 -0500 Subject: [PATCH 195/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3fe10f2c38d9c859122cfa75892418fef33e9efc Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:36 -0500 Subject: [PATCH 196/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From fa74708ee0aa7117b4dba29589237858017aeec5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:37 -0500 Subject: [PATCH 197/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From eb04717ec97250af189a081369e3821ce25e3418 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:38 -0500 Subject: [PATCH 198/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a80cee06e3b98d5b10a822a013593ff55fb02d8c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:39 -0500 Subject: [PATCH 199/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 42eb73d2dacc83595bd1267283fce961a26ccf5d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:40 -0500 Subject: [PATCH 200/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ffb955eb1ff6d624fc273994845a16d0222e9aa1 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:41 -0500 Subject: [PATCH 201/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9463f9d0c12c589e46e2915462a1cbf1d22fd341 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:41 -0500 Subject: [PATCH 202/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6d9993f35f7d2b25340dbace340454f723e089a1 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:42 -0500 Subject: [PATCH 203/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b766a3e77a51c3fe260d6f73b3f960fce5ce8fdc Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:43 -0500 Subject: [PATCH 204/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9ee5f1f089713253d3089c4d142f08571561c7db Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:44 -0500 Subject: [PATCH 205/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From cbc0199fb94d01fd4dbfdb052d3b4ae8572d1fbf Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:45 -0500 Subject: [PATCH 206/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From fe6bdcb4db46ce34bd15497f90583437664a5e81 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:46 -0500 Subject: [PATCH 207/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel Fix-review comments and file changes Signed-off-by: Pereowei Daniel Fix-updated test suites for new code changes Signed-off-by: Pereowei Daniel fix-validate json schema Signed-off-by: Pereowei Daniel fix-re-enable explorer test and update changelog Signed-off-by: Pereowei Daniel fix-add .DS_STORE to gitignore Signed-off-by: Pereowei Daniel fix-increase validation warning count Signed-off-by: Pereowei Daniel generate certs using openssl for cc container Signed-off-by: Pereowei Daniel feat-generate-tls-certs-for-ccaass-container Signed-off-by: Pereowei Daniel feat-prepare-main-for-ccaas-tls-issue Signed-off-by: Pereowei Daniel --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 +- e2e-network/TEST_CASES.md | 2 +- e2e/__snapshots__/extendConfig.test.ts.snap | 258 +++++++++++++++--- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 137 +++++++++- ...2chaincodes-private-data.yaml.test.ts.snap | 171 ++++++++++-- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 163 +++++++++-- ...1chaincode-raft-explorer.json.test.ts.snap | 137 +++++++++- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 137 +++++++++- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 137 +++++++++- e2e/fabloCommands.test.ts | 2 +- src/.DS_Store | Bin 6148 -> 0 bytes src/extend-config/extendChaincodesConfig.ts | 3 +- src/setup-docker/.DS_Store | Bin 6148 -> 0 bytes src/setup-docker/templates/.DS_Store | Bin 8196 -> 0 bytes .../templates/fabric-docker/.DS_Store | Bin 6148 -> 0 bytes .../fabric-docker/commands-generated.sh | 13 + .../chaincode-install-v2.sh | 6 +- .../fabric-docker/docker-compose.yaml | 7 +- .../scripts/base-functions-v2.sh | 41 +++ .../scripts/base-functions-v3.sh | 41 +++ .../scripts/chaincode-functions-v2.sh | 83 +++++- src/validate/index.ts | 11 + 23 files changed, 1223 insertions(+), 128 deletions(-) delete mode 100644 .DS_Store delete mode 100644 src/.DS_Store delete mode 100644 src/setup-docker/.DS_Store delete mode 100644 src/setup-docker/templates/.DS_Store delete mode 100644 src/setup-docker/templates/fabric-docker/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 47ebe4e7c27facc40cf842f489774b8eefb01b5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%SyvQ6rE|SO({Ya3SADkE!c+&;wHrU14eYAQWH}&7&9eF&7u^t)*tdq{2uR} znSjNtMeMyWbMA8{b0G6zjB$4n4jHo7tD;G(asaj75td7;0+P&p+I2!lG(Qv%#i{;5^&=-f} z0&UQD0kmqfm4IytbdWXE6y@1U5~yn1O8%j6L}Rd$s{NDL4I!~ij{*$kL- z!Rl@{4YYbbTmFH`%-UoRnx z7$64z83VjE@g^=T%ABn~mWOApfOZcJ1@lT&KtNx+1b~72NKXZIT%Znlj=@qRj)Hzw Q4oDXPMF@4oz%MZH1!K!ed;kCd diff --git a/.gitignore b/.gitignore index 52740672f..e630d9167 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ node_modules .idea .vscode samples/invalid-fablo-config.json -.DS_Store \ No newline at end of file +**/.DS_Store \ No newline at end of file diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 68ccbeb99..f59a8b921 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -19,4 +19,4 @@ | Java chaincode | no | yes | no | no | no | no | | Go chaincode | no | no | no | no | no | no | | Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer, CCAAS | - | - | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index d72aa5fbc..f422884a2 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1725,7 +1725,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -1851,14 +1867,30 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", }, - "directory": undefined, + "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1924,17 +1956,27 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, - "lang": "ccaas", + "lang": "node", "name": "chaincode1", - "peerChaincodeInstances": [ - { - "containerName": "peer0.org1.example.com_chaincode1", - "peerAddress": "peer0.org1.example.com", - "port": 7052, - }, - ], + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -2006,7 +2048,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -2132,7 +2190,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", @@ -2163,7 +2237,12 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabloConfig": "", }, "tls": true, - "tools": {}, + "tools": { + "explorer": { + "address": "explorer.example.com", + "port": 7010, + }, + }, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -2358,7 +2437,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], } @@ -11062,7 +11157,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -11188,14 +11299,30 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", }, - "directory": undefined, + "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11261,17 +11388,27 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, - "lang": "ccaas", + "lang": "node", "name": "chaincode1", - "peerChaincodeInstances": [ - { - "containerName": "peer0.org1.example.com_chaincode1", - "peerAddress": "peer0.org1.example.com", - "port": 7052, - }, - ], + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11343,7 +11480,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -11469,7 +11622,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", @@ -11500,7 +11669,12 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabloConfig": "", }, "tls": true, - "tools": {}, + "tools": { + "explorer": { + "address": "explorer.example.com", + "port": 7010, + }, + }, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -11695,7 +11869,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 20661ba31..9e0d26142 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1675,7 +1675,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" else @@ -1705,7 +1705,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1753,7 +1753,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1792,19 +1792,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -2077,6 +2077,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2441,7 +2482,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -2470,8 +2511,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2506,6 +2572,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2518,6 +2631,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2530,6 +2644,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2564,6 +2679,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index f12e61e72..12f206963 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2391,10 +2391,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" else @@ -2408,10 +2408,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" else @@ -2441,10 +2441,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2460,10 +2460,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2523,10 +2523,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2542,10 +2542,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2587,51 +2587,51 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com_or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com_or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com_and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com_and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -3005,6 +3005,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -3369,7 +3410,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -3398,8 +3439,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -3434,6 +3500,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3446,6 +3559,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -3458,6 +3572,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -3492,6 +3607,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index f8bb1ce99..9eeeb2dc7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3508,10 +3508,10 @@ installChaincodes() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" else @@ -3524,10 +3524,10 @@ installChaincodes() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" else @@ -3556,10 +3556,10 @@ installChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3574,10 +3574,10 @@ installChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3636,10 +3636,10 @@ upgradeChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3654,10 +3654,10 @@ upgradeChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3711,35 +3711,35 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode2*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org2.example.com_chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org2.example.com_chaincode2*" -q); do + for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -4408,6 +4408,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -4772,7 +4813,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -4801,8 +4842,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -4837,6 +4903,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4849,6 +4962,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -4861,6 +4975,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -4895,6 +5010,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 04ce4a1d6..123b5783f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3843,7 +3843,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -3873,7 +3873,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3921,7 +3921,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3969,19 +3969,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -4908,6 +4908,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -5272,7 +5313,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -5301,8 +5342,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -5337,6 +5403,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5349,6 +5462,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -5361,6 +5475,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -5395,6 +5510,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 49fd933c6..48fac71c5 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1760,7 +1760,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -1790,7 +1790,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1826,7 +1826,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1858,19 +1858,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -2318,6 +2318,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2688,7 +2729,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -2717,8 +2758,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2753,6 +2819,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2765,6 +2878,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2777,6 +2891,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2811,6 +2926,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 4d5c5582e..28629b62a 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1784,7 +1784,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -1814,7 +1814,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1850,7 +1850,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1882,19 +1882,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -2342,6 +2342,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2712,7 +2753,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -2741,8 +2782,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2777,6 +2843,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2789,6 +2902,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2801,6 +2915,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2835,6 +2950,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 946f66015..361c0c3f4 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -96,7 +96,7 @@ describe("validate", () => { // Then expect(commandResult).toEqual(TestCommands.success()); expect(commandResult.output).toContain("Validation errors count: 0"); - expect(commandResult.output).toContain("Validation warnings count: 1"); + expect(commandResult.output).toContain("Validation warnings count: 2"); expect(commands.getFiles()).toEqual([]); }); diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 5427131118e21d1392b51fd9acd0255b8330e003..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T0$Trc|K^g&r5YR_u=o;w4ml0V8@)sf`I5jM>s8_D~8r>kIiLK94iI zTd`Cx9z@Cv%zm@8Gg;Z0 zXwzMSP+D{?76x$zMVM4XlPc^LLzr~*OB?4}EDV}-5PD~Pj@?<<8;a1oqhIQ95UxQU znE_^Co`JHN)~WxW{(S$RPvRLfzzi%E1EO-`o%FCI+glfkqh2dfZ&67ot}ytSf`)Fz g7)!0VfvN@lk_<%GVqp+HDEuR!Y2bkw_)`Wx0F-i0-v9sr diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index fcbb81c97..1861dfec6 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -61,9 +61,10 @@ const extendChaincodesConfig = ( const peerChaincodeInstances = !chaincode.image ? [] : channel.orgs.flatMap((org) => org.peers.map((peer) => { return { - containerName: `${peer.address}_${chaincode.name}`, + containerName: `${chaincode.name}_${peer.address}`, peerAddress: peer.address, port: portCounter++, + orgDomain: org.domain }; }) ); diff --git a/src/setup-docker/.DS_Store b/src/setup-docker/.DS_Store deleted file mode 100644 index 39a4d421f40b4149b873e2a876ffef65df33988d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK-AcnS6i&A3T87XIg;F&!<`6 zpWNW+QpzMK`+jg0N3)@`dnVJ|kJD(P65=p|klX7x4dtvar)ij}Tu(bJ+p>pFb3X5M zdo6L)=`C7fe$s8X#9{Avv9PVZ{e#ns;Zrh7<%_11!=I;Q$6yJs&{?yxXK#`wGJODV znOSBK5(C5lF|a8NnDftSY|4UZox}h!@M8w>d=Q|BuE9d1Iy#`i>m&MWh$zsU74{%P{XhTy{lA<fW7Xd{BHN?QLGVlQ@0!@Da diff --git a/src/setup-docker/templates/.DS_Store b/src/setup-docker/templates/.DS_Store deleted file mode 100644 index ed8c70bd1de70c738a6eee376e0e1063ede3eca5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMTWl0n82WRu@YN&;q69eqGvyQlwPamR>-X*_{C>@G?$ zHPLuOqER2cCq5WM^udI9;fV*)#0O}IMjwn1KAG_1gO_;u&zxCsxjks22IeH^{PUml ze`n_Z=lf^&p9KKyC>YBD8UTP%7gDXI;U-P2i+)2>qM2%vNO%AX@~{L9a7o53jzAoN zI0A75;t0eM_&-K~-r1tDTfFz>YCOgfh$C=UMnF6tlGKGvMRH8a@XCZ&V}N;qJ2W{fHn49`xuWM~eU zk}@9S2*eS%F#;leCc`1nAqQSX{eBco@Ny-8G-taxvO1d^wJkqrZM}?2RrQ34HLQl! zvWGH9+)^gcgM#0od;5ge=el;Te5~j8T4pJ$)^)m0pj(dVg#gPi$z=b4W%iG#pk}H?DpKM8f}kz>Km7>-;+IRk2vl#(kYA{ z4CGB^dzRGOcxd~@PU&IQoU(^smObRWRvQ=`8qTU}!8iAqwjNkTGpz@vpH-*&jP2vwM83b4d5|rej#n;r^0k z1V@G`c1~a&vP_TjX?UQ|(MQa2b>^&w*>f~a+FZkwcNr|?tYZZ$cvx*@OrAqa&f`q| zV81~Q^tguD(Fj*GE!o7_J~7|vnKa62t}R+j0KLyAXQInox{Pzx?>kC2SVDRG3dU8V z-_~=c9ZjuSOH&UF6s5<}#rD_?ipQ#rK zqgqbUB39FlkmP2Ksl}34VOSeetx~J2Bpbc27|ezi*aX{Pn7)EJP=ZtN9Gr$%;B7bq zXW<-NfY0D__yR7$H}D<&06)TS@CO1S-h;I`38$cj^RWpRU>mN-4Y(0EV;XyK7xv2Q}h&txcLJxfmu!xW1llT-qji>Nsd=+2A*YQn!A3wy8@MAoO7w{rp!g2f_ui(%4 z3;wE9D-)C&g(;dcS7}lfEA7$?rJO_iD!o$Dq~AV=qNjv%>}ENX*w(eZ`#;H{uO^AC znKpe!UH!d{3zxL5TA#W~EJ?*O`~J%6kjNGE4~ZP!`Rf@NrWc=^=qIL|$FJp=%(rru zsWpPrY+P91$LA%~36u*`ozE8})QOY_QeBj2PN)i{pH!D7TDe+9$;Cr#d!m`E$fUBG zujOhrrI}PW@J(C=k@-^JlITpRB5Bw^C+{2Z4!lR?Jx}Dl3}3^ya0PyX-;ohnXJP}+ z#<`dv!Y;%`*o-Z>5?A9ITu1ax<2LNVZrp(x>?iUL;t=N0Kobw4i^qt<0TzhBWB3?8 zj!)oed>&uG7xAT#%5UMj*HLpvB{lJr+f%cc@f_QA4wF@x+?5;L#afm0y+PFfTW|gS z|1OSD?0Ou5J3j(gozA2?$j@6nAw{j7q<)aPXu@tx$`C?BSdNnn%W;xd|1hNEB$*0K dDw1PT(hRkK{X;?R^35$VGX6?4j=a->{24G^XjI_W3fuuhBNbi% diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index b22588f21..90e25d871 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -12,6 +12,19 @@ generateArtifacts() { "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% }) -%> + <% chaincodes.forEach((chaincode) => { + if (chaincode.lang === "ccaas" && global.tls === true) { + chaincode.channel.orgs.forEach((org) => { + org.peers.forEach((peer) => { %> + printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= peer.address %>" "U1F511" + certsGenerateCCaaS <% -%> + "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> + "<%= chaincode.name %>_<%= peer.address %>" <% -%> + "<%= org.domain %>" <% -%> + "<%= chaincode.name %>" <% -%> + "<%= peer.address %>" + <% }); }); } }); %> + <%_ ordererGroups.forEach((ordererGroup) => { _%> <% if(!global.capabilities.isV3) {%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 83cd43ce5..a0926d7b0 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -10,7 +10,7 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" <% if (chaincode.lang === "ccaas") { -%> <% chaincode.peerChaincodeInstances.forEach((instance) => { -%> - chaincodePackageCaas <% -%> + chaincodePackageCCaaS <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= instance.peerAddress %>" <% -%> "<%= chaincode.name %>" <% -%> @@ -56,7 +56,9 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%- chaincode.endorsement || '' %>" <% -%> "<%= `${chaincode.initRequired}` %>" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>'" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index d4524e82b..30118ce6d 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -377,11 +377,14 @@ services: <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> <%= instance.containerName %>: container_name: <%= instance.containerName %> + hostname: <%= instance.containerName %> image: <%= chaincode.image %> pull_policy: always environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> - - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + - CORE_CHAINCODE_ADDRESS=0.0.0.0:<%= instance.port %> + - CORE_CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + volumes: + - ../fabric-config/crypto-config/ccaas/<%= instance.containerName %>/tls:/etc/hyperledger/fabric ports: - <%= instance.port %>:7052 networks: diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index fc2f02f67..36e94761a 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -38,6 +38,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="${CONFIG_PATH}ccaas/${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/tlsca.${ORG_DOMAIN}-cert.pem" + local CA_KEY="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for ${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \ + -v "$OUTPUT_PATH:/certs" \ + -v "$CA_CERT:/ca/ca.crt:ro" \ + -v "$CA_KEY:/ca/ca.key:ro" \ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index 6f7a094cb..5585aecc7 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -38,6 +38,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="${CONFIG_PATH}ccaas/${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/tlsca.${ORG_DOMAIN}-cert.pem" + local CA_KEY="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for ${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \ + -v "$OUTPUT_PATH:/certs" \ + -v "$CA_CERT:/ca/ca.crt:ro" \ + -v "$CA_KEY:/ca/ca.key:ro" \ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 1900939a1..786cb1029 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -104,7 +104,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -133,8 +133,33 @@ chaincodePackageCaas() { echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\n", $0}') + + cat < "$PACKAGE_DIR/code/connection.json" +{ + "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", + "domain": "${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat < "$PACKAGE_DIR/code/connection.json" +{ + "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -169,6 +194,54 @@ chaincodeInstall() { "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="${CHAINCODE_NAME}_${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + + docker rm -f "$CONTAINER_NAME" > /dev/null 2>&1 || true + + docker run -d \ + --name "$CONTAINER_NAME" \ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \ + -e DEBUG=true \ + -e CORE_CHAINCODE_ID_NAME="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ + -e CHAINCODE_ID="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \ + -e CORE_CHAINCODE_LOGGING_SHIM=info \ + -e CORE_PEER_TLS_ENABLED=true \ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ + -p "$PORT_MAP" \ + --network "$NETWORK" \ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -181,6 +254,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=${10} + local CHAINCODE_LANG=${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -193,6 +267,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -227,6 +302,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/src/validate/index.ts b/src/validate/index.ts index 08b4d901e..41dc01eb7 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -91,6 +91,7 @@ class ValidateGenerator extends Generator { const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); this._validateFabricVersion(networkConfig.global); + networkConfig.chaincodes.forEach((chaincode) => this._validateCcaaTLS(networkConfig.global, chaincode)); this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); @@ -134,6 +135,16 @@ class ValidateGenerator extends Generator { } } + private _validateCcaaTLS(global: GlobalJson, chaincode: ChaincodeJson) { + if (chaincode.lang === "ccaas" && global.tls) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Chaincode '${chaincode.name}' is using CCAAS, but TLS is enabled in the network. CCAAS does not support TLS yet.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } + async shortSummary() { console.log(`Validation errors count: ${this.errors.count()}`); console.log(`Validation warnings count: ${this.warnings.count()}`); From 676e0df48c9ccb4696048ce777c7a454e4d56724 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 17:56:15 -0500 Subject: [PATCH 208/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel --- ...1chaincode-raft-explorer.json.test.ts.snap | 3474 ++++++++++++++++- 1 file changed, 3473 insertions(+), 1 deletion(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b79c8f74e..cda0d0c5b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3 +1,3475 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V2_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 1 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + Consortiums: + SampleConsortium: + Organizations: + - *Orderer + - *Org1 + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *ApplicationCapabilities + Consortium: SampleConsortium + Consortiums: + SampleConsortium: + Organizations: + - *Org1 + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 1 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Hyperledger Explorer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1", + "tlsEnable": true, + "enableAuthentication": true, + "adminCredential": { + "id": "admin", + "password": "adminpw" + }, + "connection": { + "timeout": { + "peer": { + "endorser": "300" + }, + "orderer": "300" + } + } + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "adminPrivateKey": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" + }, + "peers": [ + "peer0.org1.example.com" + ], + "signedCert": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" + } + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://peer0.org1.example.com:7041", + "tlsCACerts": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" + } + } + }, + "channels": { + "my-channel1": { + "peers": {} + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"FABLO_VERSION=2.2.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=info + +FABRIC_VERSION=2.5.12 +FABRIC_TOOLS_VERSION=2.5.12 +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=2.5.12 +FABRIC_BASEOS_VERSION=2.5.12 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + fi + + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating genesis block for group group1" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + local chaincodeName=$1 + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + local version="0.0.1" + printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + + fi +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + printHeadline "Creating new channel config blocks" "U1F537" + createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" + + printHeadline "Notyfing orgs about channels" "U1F4E2" + notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + printHeadline "Deleting new channel config blocks" "U1F52A" + deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_DB_TLS_ENABLED=false + - FABRIC_CA_SERVER_DB_TYPE=postgres + - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + depends_on: + db.ca.org1.example.com: + condition: service_healthy + networks: + - basic + + db.ca.org1.example.com: + container_name: db.ca.org1.example.com + image: postgres:\${FABRIC_CA_POSTGRES_VERSION} + environment: + - POSTGRES_PASSWORD=caDbPass12345 + - POSTGRES_USER=postgres + - POSTGRES_DB=fabriccaserver + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + fablo-rest.org1.example.com: + container_name: fablo-rest.org1.example.com + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} + environment: + - PORT=8000 + - MSP_ID=Org1MSP + - FABRIC_CA_URL=https://ca.org1.example.com:7054 + - FABRIC_CA_NAME=ca.org1.example.com + - AS_LOCALHOST=false + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - HFC_LOGGING={"error":"console","warn":"console","info":"console"} + volumes: + # note: fablo needs access to all anchor peer certs + - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro + ports: + - 8801:8000 + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # CouchDB + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + depends_on: + couchdb.peer0.org1.example.com: + condition: service_healthy + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + couchdb.peer0.org1.example.com: + container_name: couchdb.peer0.org1.example.com + image: couchdb:\${COUCHDB_VERSION} + environment: + - COUCHDB_USER=peer0 + - COUCHDB_PASSWORD=peer0Password + healthcheck: + test: "curl -f http://localhost:5984/" + interval: 5s + timeout: 10s + retries: 7 + ports: + - 5100:5984 + networks: + - basic + + db.explorer.example.com: + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + container_name: db.explorer.example.com + environment: + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWORD=password + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + explorer.example.com: + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + restart: on-failure:8 + container_name: explorer.example.com + environment: + - DATABASE_HOST=db.explorer.example.com + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWD=password + - LOG_LEVEL_APP=debug + - LOG_LEVEL_DB=debug + - LOG_LEVEL_CONSOLE=info + - LOG_CONSOLE_STDOUT=true + - DISCOVERY_AS_LOCALHOST=false + volumes: + - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json + - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile + - ../fabric-config/crypto-config:/tmp/crypto + ports: + - "7010:8080" + depends_on: + db.explorer.example.com: + condition: service_healthy + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx + peer channel join -b "\${CHANNEL_NAME}".block + + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + peer0.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + " +} + +__getCAPostgresNodes() { + echo " + db.ca.org1.example.com + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" + +perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; From 60f08567f557207e757bfc0d3ebd3350d01aa19f Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 08:49:17 +0200 Subject: [PATCH 209/471] Checkpoint Signed-off-by: Jakub Dzikowski --- e2e-network/docker/test-01-simple.sh | 20 +-- src/extend-config/extendChaincodesConfig.ts | 51 +++---- src/init/index.ts | 125 +++++++++--------- .../fabric-docker/commands-generated.sh | 15 +-- .../chaincode-install-v2.sh | 28 ++-- .../fabric-docker/docker-compose.yaml | 18 --- .../scripts/chaincode-functions-v2.sh | 48 +++++-- src/validate/index.ts | 10 +- 8 files changed, 164 insertions(+), 151 deletions(-) diff --git a/e2e-network/docker/test-01-simple.sh b/e2e-network/docker/test-01-simple.sh index 2538e93cf..5c4b33eaa 100755 --- a/e2e-network/docker/test-01-simple.sh +++ b/e2e-network/docker/test-01-simple.sh @@ -2,7 +2,7 @@ set -e -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_TMP="$(rm -rf "$0.tmpdir2" && mkdir -p "$0.tmpdir2" && (cd "$0.tmpdir2" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." @@ -49,22 +49,22 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT networkUp waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" -waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +# waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" +# waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +# waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +# waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" # Test simple chaincode expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' +# expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ +# '{"Args":["KVContract:get", "name"]}' \ +# '{\"success\":\"Willy Wonka\"}' # Verify channel query scripts (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) @@ -81,7 +81,7 @@ expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my- # Reset and ensure the state is lost after reset (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +# waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:get", "name"]}' \ '{\"error\":\"NOT_FOUND\"}' diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index 1861dfec6..4d55c70a5 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -58,36 +58,39 @@ const extendChaincodesConfig = ( ); const privateDataConfigFile = privateData.length > 0 ? `collections/${chaincode.name}.json` : undefined; - const peerChaincodeInstances = !chaincode.image ? [] : channel.orgs.flatMap((org) => - org.peers.map((peer) => { - return { - containerName: `${chaincode.name}_${peer.address}`, - peerAddress: peer.address, - port: portCounter++, - orgDomain: org.domain - }; - }) - ); + const peerChaincodeInstances = !chaincode.image + ? [] + : channel.orgs.flatMap((org) => + org.peers.map((peer) => { + return { + // the beginning of the name matches the convention used by regular local Fabric chaincode containers + containerName: `ccaas-${peer.address}-${chaincode.name}`, + peerAddress: peer.address, + port: portCounter++, + orgDomain: org.domain, + }; + }), + ); if (chaincode.lang === "ccaas") { if (!chaincode.image) { throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify an image field`); } } - return { - directory: chaincode.directory, - name: chaincode.name, - version: chaincode.version, - lang: chaincode.lang, - channel, - image: chaincode.image, - ...initParams, - endorsement, - instantiatingOrg: channel.instantiatingOrg, - privateDataConfigFile, - peerChaincodeInstances, - privateData, - }; + return { + directory: chaincode.directory, + name: chaincode.name, + version: chaincode.version, + lang: chaincode.lang, + channel, + image: chaincode.image, + ...initParams, + endorsement, + instantiatingOrg: channel.instantiatingOrg, + privateDataConfigFile, + peerChaincodeInstances, + privateData, + }; }); }; diff --git a/src/init/index.ts b/src/init/index.ts index 52d90bd11..163ded860 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -1,76 +1,77 @@ import * as Generator from "yeoman-generator"; import * as chalk from "chalk"; import { GlobalJson, FabloConfigJson } from "../types/FabloConfigJson"; +import { version } from "../../package.json"; function getDefaultFabloConfig(): FabloConfigJson { return { - $schema: "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", - global: { - fabricVersion: "2.5.9", - tls: false, - peerDevMode: false, - }, - orgs: [ - { - organization: { - name: "Orderer", - domain: "orderer.example.com", - mspName: "OrdererMSP", - }, - ca: { - prefix: "ca", - db: "sqlite", + $schema: `https://github.com/hyperledger-labs/fablo/releases/download/${version}/schema.json`, + global: { + fabricVersion: "2.5.12", + tls: true, + peerDevMode: false, + }, + orgs: [ + { + organization: { + name: "Orderer", + domain: "orderer.example.com", + mspName: "OrdererMSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [ + { + groupName: "group1", + type: "raft", + instances: 1, + prefix: "orderer", + }, + ], }, - orderers: [ - { - groupName: "group1", - type: "solo", + { + organization: { + name: "Org1", + domain: "org1.example.com", + mspName: "Org1MSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [], + peer: { instances: 1, - prefix: "orderer", + db: "LevelDb", + prefix: "peer", }, - ], - }, - { - organization: { - name: "Org1", - domain: "org1.example.com", - mspName: "Org1MSP", }, - ca: { - prefix: "ca", - db: "sqlite", + ], + channels: [ + { + name: "my-channel1", + orgs: [ + { + name: "Org1", + peers: ["peer0", "peer1"], + }, + ], }, - orderers: [], - peer: { - instances: 2, - db: "LevelDb", - prefix: "peer", + ], + chaincodes: [ + { + name: "chaincode1", + version: "0.0.1", + lang: "ccaas", + channel: "my-channel1", + image: "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + privateData: [], }, - }, - ], - channels: [ - { - name: "my-channel1", - orgs: [ - { - name: "Org1", - peers: ["peer0", "peer1"], - }, - ], - }, - ], - chaincodes: [ - { - name: "chaincode1", - version: "0.0.1", - lang: "node", - channel: "my-channel1", - directory: "./chaincodes/chaincode-kv-node", - privateData: [], - }, - ], - hooks: {}, - }; + ], + hooks: {}, + }; } export default class InitGenerator extends Generator { @@ -118,4 +119,4 @@ export default class InitGenerator extends Generator { console.log("==========================================================="); }); } -} \ No newline at end of file +} diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 90e25d871..93112509b 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -14,16 +14,15 @@ generateArtifacts() { <% }) -%> <% chaincodes.forEach((chaincode) => { if (chaincode.lang === "ccaas" && global.tls === true) { - chaincode.channel.orgs.forEach((org) => { - org.peers.forEach((peer) => { %> - printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= peer.address %>" "U1F511" + chaincode.peerChaincodeInstances.forEach((instance) => { %> + printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= instance.peerAddress %>" "U1F511" certsGenerateCCaaS <% -%> "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> - "<%= chaincode.name %>_<%= peer.address %>" <% -%> - "<%= org.domain %>" <% -%> + "<%= instance.containerName %>" <% -%> + "<%= instance.orgDomain %>" <% -%> "<%= chaincode.name %>" <% -%> - "<%= peer.address %>" - <% }); }); } }); %> + "<%= instance.peerAddress %>" + <% }); } }); %> <%_ ordererGroups.forEach((ordererGroup) => { _%> @@ -266,7 +265,7 @@ networkDown() { <% chaincodes.forEach((chaincode) => { -%> <% chaincode.channel.orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - <% const chaincodeContainerName=`dev-${peer.address}-${chaincode.name}` -%> + <% const chaincodeContainerName=`ccaas-${peer.address}-${chaincode.name}` -%> for container in $(docker ps -a | grep "<%= chaincodeContainerName %>" | awk '{print $1}'); do echo "Removing container $container..."; docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted"; done for image in $(docker images "<%= chaincodeContainerName %>*" -q); do echo "Removing image $image..."; docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted"; done <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index a0926d7b0..542c7a7bf 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -46,19 +46,21 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "$version" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% }) -%> - chaincodeApprove <% -%> - "<%= org.cli.address %>" <% -%> - "<%= org.headPeer.fullAddress %>" <% -%> - "<%= chaincode.channel.name %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> - "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" + <% org.peers.forEach((peer) => { -%> + chaincodeApprove <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.channel.name %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> + "<%- chaincode.endorsement || '' %>" <% -%> + "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" + <% }) -%> <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>'" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 30118ce6d..df5e3489f 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -373,21 +373,3 @@ services: networks: - basic <%_ } _%> -<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> - <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> - <%= instance.containerName %>: - container_name: <%= instance.containerName %> - hostname: <%= instance.containerName %> - image: <%= chaincode.image %> - pull_policy: always - environment: - - CORE_CHAINCODE_ADDRESS=0.0.0.0:<%= instance.port %> - - CORE_CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> - volumes: - - ../fabric-config/crypto-config/ccaas/<%= instance.containerName %>/tls:/etc/hyperledger/fabric - ports: - - <%= instance.port %>:7052 - networks: - - basic - <% }) %> -<% } }) %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 786cb1029..ed41f848d 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -135,9 +135,10 @@ chaincodePackageCCaaS() { mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\n", $0}') + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local ROOT_CERT=$(cat "$TLS_PATH/peer.crt" | awk '{printf "%s\\n", $0}') + local SERVER_CERT=$(cat "$TLS_PATH/client.crt" | awk '{printf "%s\\n", $0}') + local SERVER_KEY=$(cat "$TLS_PATH/client.key" | awk '{printf "%s\\n", $0}') cat < "$PACKAGE_DIR/code/connection.json" { @@ -188,6 +189,8 @@ chaincodeInstall() { if [ -n "$CA_CERT" ]; then CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") fi + + set -x docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ @@ -202,15 +205,37 @@ restartChaincodeContainerWithCorrectId() { local CHAINCODE_IMAGE="$5" local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="${CHAINCODE_NAME}_${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" local PORT_MAP="7052:7052" + # Use different ports for different containers to avoid conflicts + if [[ "$CONTAINER_NAME" == *"peer1"* ]]; then + PORT_MAP="7053:7052" + fi + local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + # Verify all required TLS files exist + local REQUIRED_TLS_FILES=( + "$TLS_PATH/client.key" + "$TLS_PATH/client.crt" + "$TLS_PATH/client_pem.key" + "$TLS_PATH/client_pem.crt" + "$TLS_PATH/peer.crt" + ) + + echo "Verifying TLS files exist..." + for file in "${REQUIRED_TLS_FILES[@]}"; do + if [ ! -f "$file" ]; then + echo "ERROR: Required TLS file missing: $file" + exit 1 + fi + echo "✓ Found: $file" + done docker rm -f "$CONTAINER_NAME" > /dev/null 2>&1 || true @@ -218,20 +243,15 @@ restartChaincodeContainerWithCorrectId() { --name "$CONTAINER_NAME" \ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \ - -e DEBUG=true \ -e CORE_CHAINCODE_ID_NAME="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CHAINCODE_ID="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CORE_CHAINCODE_LOGGING_LEVEL=info \ -e CORE_CHAINCODE_LOGGING_SHIM=info \ -e CORE_PEER_TLS_ENABLED=true \ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ - -e CORE_PEER_LOCALMSPID=Org1MSP \ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \ @@ -240,6 +260,10 @@ restartChaincodeContainerWithCorrectId() { -p "$PORT_MAP" \ --network "$NETWORK" \ "$CHAINCODE_IMAGE" + + # Redirect container logs to the log file in the background + echo "Redirecting container logs to $(pwd)/$CONTAINER_NAME.log" + docker logs -f "$CONTAINER_NAME" > "./$CONTAINER_NAME.log" 2>&1 & } chaincodeApprove() { @@ -297,8 +321,10 @@ chaincodeApprove() { --output json \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" )" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/src/validate/index.ts b/src/validate/index.ts index 41dc01eb7..184f03010 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -137,11 +137,11 @@ class ValidateGenerator extends Generator { private _validateCcaaTLS(global: GlobalJson, chaincode: ChaincodeJson) { if (chaincode.lang === "ccaas" && global.tls) { - const objectToEmit = { - category: validationCategories.CRITICAL, - message: `Chaincode '${chaincode.name}' is using CCAAS, but TLS is enabled in the network. CCAAS does not support TLS yet.`, - }; - this.emit(validationErrorType.CRITICAL, objectToEmit); + // const objectToEmit = { + // category: validationCategories.CRITICAL, + // message: `Chaincode '${chaincode.name}' is using CCAAS, but TLS is enabled in the network. CCAAS does not support TLS yet.`, + // }; + // TODO this.emit(validationErrorType.CRITICAL, objectToEmit); } } From 81066379addfafd512cf24809d71ff2f60f6b66c Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 12:26:19 +0200 Subject: [PATCH 210/471] PoC of CCaaS Signed-off-by: Jakub Dzikowski --- .../chaincodes/chaincode-kv-node/package.json | 2 +- .../fabric-docker/commands-generated.sh | 20 +---- .../scripts/base-functions-v2.sh | 26 +++++- .../scripts/chaincode-functions-v2.sh | 85 ++++++++++++++----- 4 files changed, 95 insertions(+), 38 deletions(-) diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index 4751eb2e3..f50ae9b09 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -8,7 +8,7 @@ }, "scripts": { "start": "fabric-chaincode-node start", - "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\"", + "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"$CHAINCODE_ID\"", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 93112509b..8c71fb984 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -12,18 +12,6 @@ generateArtifacts() { "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% }) -%> - <% chaincodes.forEach((chaincode) => { - if (chaincode.lang === "ccaas" && global.tls === true) { - chaincode.peerChaincodeInstances.forEach((instance) => { %> - printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= instance.peerAddress %>" "U1F511" - certsGenerateCCaaS <% -%> - "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> - "<%= instance.containerName %>" <% -%> - "<%= instance.orgDomain %>" <% -%> - "<%= chaincode.name %>" <% -%> - "<%= instance.peerAddress %>" - <% }); } }); %> - <%_ ordererGroups.forEach((ordererGroup) => { _%> <% if(!global.capabilities.isV3) {%> @@ -258,20 +246,20 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \U1F5D1 \n" <% chaincodes.forEach((chaincode) => { -%> <% chaincode.channel.orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - <% const chaincodeContainerName=`ccaas-${peer.address}-${chaincode.name}` -%> + <% const chaincodeContainerName=`ccaas-` -%> for container in $(docker ps -a | grep "<%= chaincodeContainerName %>" | awk '{print $1}'); do echo "Removing container $container..."; docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted"; done for image in $(docker images "<%= chaincodeContainerName %>*" -q); do echo "Removing image $image..."; docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted"; done <% }) -%> <% }) -%> <% }) -%> + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \U1F5D1 \n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 36e94761a..966e52363 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -68,9 +68,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index ed41f848d..5212bd1bb 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -135,10 +135,11 @@ chaincodePackageCCaaS() { mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local ROOT_CERT=$(cat "$TLS_PATH/peer.crt" | awk '{printf "%s\\n", $0}') - local SERVER_CERT=$(cat "$TLS_PATH/client.crt" | awk '{printf "%s\\n", $0}') - local SERVER_KEY=$(cat "$TLS_PATH/client.key" | awk '{printf "%s\\n", $0}') + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\n", $0}') cat < "$PACKAGE_DIR/code/connection.json" { @@ -209,7 +210,10 @@ restartChaincodeContainerWithCorrectId() { echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + # Extract peer name and organization domain from peer address + local PEER_NAME="${PEER_ADDRESS%%:*}" + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" local PORT_MAP="7052:7052" # Use different ports for different containers to avoid conflicts @@ -219,19 +223,24 @@ restartChaincodeContainerWithCorrectId() { local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - # Verify all required TLS files exist + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Verify CCAAS TLS files exist local REQUIRED_TLS_FILES=( - "$TLS_PATH/client.key" - "$TLS_PATH/client.crt" - "$TLS_PATH/client_pem.key" - "$TLS_PATH/client_pem.crt" - "$TLS_PATH/peer.crt" + "$CCAAS_TLS_PATH/client.key" + "$CCAAS_TLS_PATH/client.crt" + "$CCAAS_TLS_PATH/peer.crt" ) - echo "Verifying TLS files exist..." + echo "Verifying CCAAS TLS files exist for $CONTAINER_NAME..." for file in "${REQUIRED_TLS_FILES[@]}"; do if [ ! -f "$file" ]; then - echo "ERROR: Required TLS file missing: $file" + echo "ERROR: Required CCAAS TLS file missing: $file" exit 1 fi echo "✓ Found: $file" @@ -242,7 +251,7 @@ restartChaincodeContainerWithCorrectId() { docker run -d \ --name "$CONTAINER_NAME" \ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \ -e CORE_CHAINCODE_ID_NAME="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CHAINCODE_ID="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CORE_CHAINCODE_LOGGING_LEVEL=info \ @@ -252,11 +261,9 @@ restartChaincodeContainerWithCorrectId() { -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ -e CORE_PEER_LOCALMSPID=Org1MSP \ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ -p "$PORT_MAP" \ --network "$NETWORK" \ "$CHAINCODE_IMAGE" @@ -264,6 +271,46 @@ restartChaincodeContainerWithCorrectId() { # Redirect container logs to the log file in the background echo "Redirecting container logs to $(pwd)/$CONTAINER_NAME.log" docker logs -f "$CONTAINER_NAME" > "./$CONTAINER_NAME.log" 2>&1 & + + # Wait for the container to be ready + echo "Waiting for CCaaS container to be ready..." + local MAX_ATTEMPTS=30 + local ATTEMPT=1 + + # Give the container a moment to start + sleep 3 + + while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do + # First check if container is running + if ! docker ps --format "{{.Names}}" | grep -q "^$CONTAINER_NAME$"; then + echo "❌ Container $CONTAINER_NAME is not running" + docker logs "$CONTAINER_NAME" + exit 1 + fi + + # Check if the container is listening on port 7052 + if docker exec "$CONTAINER_NAME" sh -c "netstat -tlnp 2>/dev/null | grep :7052" > /dev/null 2>&1; then + echo "✅ CCaaS container is ready on port 7052" + break + fi + + # Alternative check: try to connect to the port from outside + if timeout 2 bash -c " /dev/null 2>&1; then + echo "✅ CCaaS container is ready on port 7052 (external check)" + break + fi + + if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then + echo "❌ Timeout waiting for CCaaS container to be ready" + echo "Container logs:" + docker logs "$CONTAINER_NAME" + exit 1 + fi + + echo "⏳ Waiting for CCaaS container to be ready... (attempt $ATTEMPT/$MAX_ATTEMPTS)" + sleep 2 + ATTEMPT=$((ATTEMPT + 1)) + done } chaincodeApprove() { From a1fc70cf442cba02ce192debe2e5ed73cdb80b26 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 13:26:30 +0200 Subject: [PATCH 211/471] PoC (checkpoint working) Signed-off-by: Jakub Dzikowski --- src/init/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init/index.ts b/src/init/index.ts index 163ded860..ca0e9135c 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -55,7 +55,7 @@ function getDefaultFabloConfig(): FabloConfigJson { orgs: [ { name: "Org1", - peers: ["peer0", "peer1"], + peers: ["peer0"], }, ], }, From 82d0e6ae8b5030c63b3b03bf2e9c3c9cfe0c822f Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 14:31:42 +0200 Subject: [PATCH 212/471] Rafactor and use proper ports Signed-off-by: Jakub Dzikowski --- src/extend-config/extendChaincodesConfig.ts | 6 +- .../commands-generated/chaincode-dev-v2.sh | 4 +- .../chaincode-install-v2.sh | 37 ++-- .../scripts/chaincode-functions-v2.sh | 205 +++++++++--------- 4 files changed, 130 insertions(+), 122 deletions(-) diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index 4d55c70a5..a70b00b53 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -42,8 +42,7 @@ const extendChaincodesConfig = ( transformedChannels: ChannelConfig[], network: Global, ): ChaincodeConfig[] => { - let portCounter = 7052; - return chaincodes.map((chaincode) => { + return chaincodes.map((chaincode, index) => { const channel = transformedChannels.find((c) => c.name === chaincode.channel); if (!channel) throw new Error(`No matching channel with name '${chaincode.channel}'`); @@ -63,10 +62,9 @@ const extendChaincodesConfig = ( : channel.orgs.flatMap((org) => org.peers.map((peer) => { return { - // the beginning of the name matches the convention used by regular local Fabric chaincode containers containerName: `ccaas-${peer.address}-${chaincode.name}`, peerAddress: peer.address, - port: portCounter++, + port: 10000 * (index + 1) + peer.port, orgDomain: org.domain, }; }), diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh index f165969fd..130691b26 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh @@ -16,7 +16,9 @@ "<%- chaincode.endorsement || '' %>" <% -%> "false" <% -%> "" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "" <% -%> + "" <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>' (dev mode)" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 542c7a7bf..a31f7116a 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -22,13 +22,11 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= global.tls %>" <% }) -%> <% } else { -%> - <% if (!chaincode.image) { -%> - chaincodeBuild <% -%> - "<%= chaincode.name %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> - "<%= global.fabricRecommendedNodeVersion %>" - <% } -%> + chaincodeBuild <% -%> + "<%= chaincode.name %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> + "<%= global.fabricRecommendedNodeVersion %>" chaincodePackage <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> @@ -38,13 +36,24 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" <% } -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" - <% org.peers.forEach((peer) => { -%> - chaincodeInstall <% -%> - "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% org.peers.forEach((peer, i) => { -%> + <% if (chaincode.lang === "ccaas") { -%> + chaincodeInstallCCaaS <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.image %>" <% -%> + "<%= chaincode.peerChaincodeInstances[i].port %>" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% } else { -%> + chaincodeInstall <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% } -%> <% }) -%> <% org.peers.forEach((peer) => { -%> chaincodeApprove <% -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 5212bd1bb..1cc87db28 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -9,29 +9,27 @@ dockerPullIfMissing() { fi } -node_version_check(){ - - local fabric_shim_version="$1" - local nodejs_version +node_version_check() { + local fabric_shim_version="$1" + local nodejs_version - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 - else - nodejs_version=18.12 - fi - - echo $nodejs_version + else + nodejs_version=18.12 + fi + echo $nodejs_version } chaincodeBuild() { @@ -73,10 +71,9 @@ chaincodeBuild() { inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - + # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -116,7 +113,7 @@ chaincodePackageCCaaS() { local CONTAINER_NAME=$8 local TLS_ENABLED=$9 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" @@ -124,13 +121,13 @@ chaincodePackageCCaaS() { inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + mkdir -p "$PACKAGE_DIR" - echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" @@ -141,34 +138,31 @@ chaincodePackageCCaaS() { local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\n", $0}') local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\n", $0}') - cat < "$PACKAGE_DIR/code/connection.json" -{ - "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", - "domain": "${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + echo "{ + \"address\": \"${ACTUAL_CONTAINER_NAME}:7052\", + \"domain\": \"${ACTUAL_CONTAINER_NAME}\", + \"dial_timeout\": \"10s\", + \"tls_required\": $TLS_ENABLED, + \"client_auth_required\": true, + \"client_cert\": \"$SERVER_CERT\", + \"client_key\": \"$SERVER_KEY\", + \"root_cert\": \"$ROOT_CERT\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat < "$PACKAGE_DIR/code/connection.json" -{ - "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \"address\": \"${ACTUAL_CONTAINER_NAME}:7052\", + \"dial_timeout\": \"10s\", + \"tls_required\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } @@ -190,37 +184,90 @@ chaincodeInstall() { if [ -n "$CA_CERT" ]; then CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") fi - - set -x docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +chaincodeInstallCCaaS() { + set -x + + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local EXTERNAL_PORT=$6 + local CA_CERT=$7 + + local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" + + # Install the chaincode + INSTALL_RESPONSE="$(chaincodeInstall "$CLI_NAME" "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_VERSION" "$CA_CERT")" + echo "INSTALL_RESPONSE: $INSTALL_RESPONSE" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \ + --output json \ + "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" + )" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + startCCaaSContainer "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$PACKAGE_ID" "$CHAINCODE_IMAGE" "$EXTERNAL_PORT" +} + +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" local CC_PACKAGE_ID="$4" local CHAINCODE_IMAGE="$5" + local EXTERNAL_PORT="$6" local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" + # If PACKAGE_HASH is empty, use the full CC_PACKAGE_ID + if [ -z "$PACKAGE_HASH" ]; then + PACKAGE_HASH="$CC_PACKAGE_ID" + fi + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" # Extract peer name and organization domain from peer address local PEER_NAME="${PEER_ADDRESS%%:*}" local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\.//') local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="7052:7052" - + # The connection.json expects the container to be accessible on CONTAINER_PORT (17041) + # The container internally listens on 7052, so we map EXTERNAL_PORT:7052 + # This allows the peer to connect to EXTERNAL_PORT and reach the container's 7052 port + local PORT_MAP="${EXTERNAL_PORT}:7052" + # Use different ports for different containers to avoid conflicts if [[ "$CONTAINER_NAME" == *"peer1"* ]]; then PORT_MAP="7053:7052" fi - + local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') # Generate CCAAS-specific certificates with correct CN @@ -246,7 +293,7 @@ restartChaincodeContainerWithCorrectId() { echo "✓ Found: $file" done - docker rm -f "$CONTAINER_NAME" > /dev/null 2>&1 || true + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true docker run -d \ --name "$CONTAINER_NAME" \ @@ -267,50 +314,6 @@ restartChaincodeContainerWithCorrectId() { -p "$PORT_MAP" \ --network "$NETWORK" \ "$CHAINCODE_IMAGE" - - # Redirect container logs to the log file in the background - echo "Redirecting container logs to $(pwd)/$CONTAINER_NAME.log" - docker logs -f "$CONTAINER_NAME" > "./$CONTAINER_NAME.log" 2>&1 & - - # Wait for the container to be ready - echo "Waiting for CCaaS container to be ready..." - local MAX_ATTEMPTS=30 - local ATTEMPT=1 - - # Give the container a moment to start - sleep 3 - - while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do - # First check if container is running - if ! docker ps --format "{{.Names}}" | grep -q "^$CONTAINER_NAME$"; then - echo "❌ Container $CONTAINER_NAME is not running" - docker logs "$CONTAINER_NAME" - exit 1 - fi - - # Check if the container is listening on port 7052 - if docker exec "$CONTAINER_NAME" sh -c "netstat -tlnp 2>/dev/null | grep :7052" > /dev/null 2>&1; then - echo "✅ CCaaS container is ready on port 7052" - break - fi - - # Alternative check: try to connect to the port from outside - if timeout 2 bash -c " /dev/null 2>&1; then - echo "✅ CCaaS container is ready on port 7052 (external check)" - break - fi - - if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then - echo "❌ Timeout waiting for CCaaS container to be ready" - echo "Container logs:" - docker logs "$CONTAINER_NAME" - exit 1 - fi - - echo "⏳ Waiting for CCaaS container to be ready... (attempt $ATTEMPT/$MAX_ATTEMPTS)" - sleep 2 - ATTEMPT=$((ATTEMPT + 1)) - done } chaincodeApprove() { @@ -375,10 +378,6 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE From 620c22aa20231c17790383440978b17fc33d969f Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 14:41:15 +0200 Subject: [PATCH 213/471] Fixes for multiple peers Signed-off-by: Jakub Dzikowski --- src/init/index.ts | 4 +-- .../chaincode-install-v2.sh | 28 +++++++++---------- .../scripts/chaincode-functions-v2.sh | 5 ---- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/init/index.ts b/src/init/index.ts index ca0e9135c..1055e4b60 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -43,7 +43,7 @@ function getDefaultFabloConfig(): FabloConfigJson { }, orderers: [], peer: { - instances: 1, + instances: 2, db: "LevelDb", prefix: "peer", }, @@ -55,7 +55,7 @@ function getDefaultFabloConfig(): FabloConfigJson { orgs: [ { name: "Org1", - peers: ["peer0"], + peers: ["peer0", "peer1"], }, ], }, diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index a31f7116a..c83c826ac 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -55,21 +55,19 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% } -%> <% }) -%> - <% org.peers.forEach((peer) => { -%> - chaincodeApprove <% -%> - "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.channel.name %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> - "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" - <% }) -%> + chaincodeApprove <% -%> + "<%= org.cli.address %>" <% -%> + "<%= org.headPeer.fullAddress %>" <% -%> + "<%= chaincode.channel.name %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> + "<%- chaincode.endorsement || '' %>" <% -%> + "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>'" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 1cc87db28..d21aa423b 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -263,11 +263,6 @@ startCCaaSContainer() { # This allows the peer to connect to EXTERNAL_PORT and reach the container's 7052 port local PORT_MAP="${EXTERNAL_PORT}:7052" - # Use different ports for different containers to avoid conflicts - if [[ "$CONTAINER_NAME" == *"peer1"* ]]; then - PORT_MAP="7053:7052" - fi - local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') # Generate CCAAS-specific certificates with correct CN From df1c9f3c9fbf166ba2016e5f140deec4842263ad Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 14:55:07 +0200 Subject: [PATCH 214/471] Refactoring Signed-off-by: Jakub Dzikowski --- e2e-network/docker/test-01-simple.sh | 20 +++--- .../chaincode-install-v2.sh | 17 +++-- .../scripts/chaincode-functions-v2.sh | 66 ++++--------------- 3 files changed, 30 insertions(+), 73 deletions(-) diff --git a/e2e-network/docker/test-01-simple.sh b/e2e-network/docker/test-01-simple.sh index 5c4b33eaa..3c21fc023 100755 --- a/e2e-network/docker/test-01-simple.sh +++ b/e2e-network/docker/test-01-simple.sh @@ -2,7 +2,7 @@ set -e -TEST_TMP="$(rm -rf "$0.tmpdir2" && mkdir -p "$0.tmpdir2" && (cd "$0.tmpdir2" && pwd))" +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." @@ -51,20 +51,20 @@ networkUp waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -# waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -# waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -# waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -# waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" # Test simple chaincode expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ '{\"success\":\"OK\"}' -# expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ -# '{"Args":["KVContract:get", "name"]}' \ -# '{\"success\":\"Willy Wonka\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' # Verify channel query scripts (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) @@ -89,4 +89,6 @@ expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ # Put some data again expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "James Bond"]}' \ - '{\"success\":\"OK\"}' \ No newline at end of file + '{\"success\":\"OK\"}' + +echo "✅ Test passed!" \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index c83c826ac..7330ccaa5 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -37,21 +37,20 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" <% org.peers.forEach((peer, i) => { -%> + chaincodeInstall <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% if (chaincode.lang === "ccaas") { -%> - chaincodeInstallCCaaS <% -%> - "<%= org.cli.address %>" <% -%> + startCCaaSContainer <% -%> "<%= peer.fullAddress %>" <% -%> "<%= chaincode.name %>" <% -%> - "$version" <% -%> + "<%= chaincode.name %>_$version" <% -%> "<%= chaincode.image %>" <% -%> "<%= chaincode.peerChaincodeInstances[i].port %>" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" - <% } else { -%> - chaincodeInstall <% -%> "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% } -%> <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index d21aa423b..020809c49 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -190,24 +190,17 @@ chaincodeInstall() { "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" } -chaincodeInstallCCaaS() { - set -x - - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local EXTERNAL_PORT=$6 - local CA_CERT=$7 +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" - # Install the chaincode - INSTALL_RESPONSE="$(chaincodeInstall "$CLI_NAME" "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_VERSION" "$CA_CERT")" - echo "INSTALL_RESPONSE: $INSTALL_RESPONSE" - # Query installed chaincodes to get the package ID local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -222,35 +215,17 @@ chaincodeInstallCCaaS() { --output json \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" )" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - + if [ -z "$PACKAGE_ID" ]; then echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" exit 1 fi - - echo "PACKAGE_ID: $PACKAGE_ID" - startCCaaSContainer "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$PACKAGE_ID" "$CHAINCODE_IMAGE" "$EXTERNAL_PORT" -} - -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" - local EXTERNAL_PORT="$6" - - local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" + echo "PACKAGE_ID: $PACKAGE_ID" - # If PACKAGE_HASH is empty, use the full CC_PACKAGE_ID - if [ -z "$PACKAGE_HASH" ]; then - PACKAGE_HASH="$CC_PACKAGE_ID" - fi + local PACKAGE_HASH="${PACKAGE_ID#*:}" echo "Starting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" @@ -272,24 +247,6 @@ startCCaaSContainer() { # Use generated CCAAS certificates local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - # Verify CCAAS TLS files exist - local REQUIRED_TLS_FILES=( - "$CCAAS_TLS_PATH/client.key" - "$CCAAS_TLS_PATH/client.crt" - "$CCAAS_TLS_PATH/peer.crt" - ) - - echo "Verifying CCAAS TLS files exist for $CONTAINER_NAME..." - for file in "${REQUIRED_TLS_FILES[@]}"; do - if [ ! -f "$file" ]; then - echo "ERROR: Required CCAAS TLS file missing: $file" - exit 1 - fi - echo "✓ Found: $file" - done - - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true - docker run -d \ --name "$CONTAINER_NAME" \ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ @@ -366,7 +323,6 @@ chaincodeApprove() { --output json \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" )" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" From b84d574e308ed767b0c66cda0f8153a85dc1ab67 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 15:40:12 +0200 Subject: [PATCH 215/471] Pre-review fixes Signed-off-by: Jakub Dzikowski --- .github/workflows/publish-docker-on-main.yml | 8 +- .github/workflows/test-on-push.yml | 40 ++++----- .gitignore | 2 +- docs/schema.json | 7 -- e2e-network/docker/test-01-v2-simple.sh | 4 +- e2e-network/docker/test-04-v2-snapshot.sh | 4 +- e2e-network/docker/test-05-version3-BFT.sh | 87 ------------------- e2e-network/docker/test-05-version3.sh | 84 ------------------ src/init/index.ts | 2 +- src/repositoryUtils.test.ts | 40 +-------- .../fabric-docker/commands-generated.sh | 2 +- .../chaincode-install-v2.sh | 5 +- .../fabric-docker/docker-compose.yaml | 2 +- .../scripts/chaincode-functions-v2.sh | 24 ++--- src/types/FabloConfigExtended.ts | 2 +- src/utils/parseFabloConfig.test.ts | 52 +++++------ 16 files changed, 66 insertions(+), 299 deletions(-) delete mode 100755 e2e-network/docker/test-05-version3-BFT.sh delete mode 100755 e2e-network/docker/test-05-version3.sh diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index 633eeaafc..c76586b28 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -18,17 +18,12 @@ jobs: with: driver: docker-container - - name: Login to GHCR - uses: docker/login-action@v3 - name: Login to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ secrets.GHCR_USER }} password: ${{ secrets.GHCR_TOKEN }} - registry: ghcr.io - username: ${{ secrets.GHCR_USER }} - password: ${{ secrets.GHCR_TOKEN }} - name: Build and push Docker image run: | @@ -39,8 +34,9 @@ jobs: - name: Build and push node chaincode run: | + FABLO_VERSION=$(cat package.json | jq -r '.version') docker buildx build \ --platform linux/amd64,linux/arm64 \ --tag "ghcr.io/fablo-io/fablo-kv-node-chaincode-sample:$FABLO_VERSION" \ --push \ - samples/chaincodes/chaincode-kv-node + samples/chaincodes/chaincode-kv-node \ No newline at end of file diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index 211b625a2..6dfade3bb 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -23,7 +23,6 @@ jobs: - name: Test simple network run: e2e-network/docker/test-01-v2-simple.sh - - uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4 if: always() with: @@ -41,7 +40,6 @@ jobs: - name: Lint run: npm run lint && ./lint.sh - # test-k8: # needs: test-main # runs-on: ubuntu-latest @@ -164,26 +162,25 @@ jobs: - name: Test snapshots run: e2e-network/docker/test-04-v2-snapshot.sh - - uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4 if: always() with: name: test-04-snapshot path: | - e2e-network/docker/test-04-snapshot.sh.logs/* - e2e-network/docker/test-04-snapshot.sh.tmpdir/fablo-target/**/* - + e2e-network/docker/test-04-v2-snapshot.sh.logs/* + e2e-network/docker/test-04-v2-snapshot.sh.tmpdir/fablo-target/**/* + test-05-v3: needs: test-main - runs-on: macos-15 + runs-on: macos-15 steps: - name: Check out repository code uses: actions/checkout@v2 - + - name: Install Docker + Colima run: | brew update - brew install qemu colima docker + brew install qemu colima docker brew uninstall --ignore-dependencies lima curl https://raw.githubusercontent.com/Homebrew/homebrew-core/45464b6c4788a80be3f131ab5e2a4468cdfa960c/Formula/l/lima.rb > lima.rb brew install lima.rb @@ -201,24 +198,23 @@ jobs: npm install -g npm@latest npm install - - name: Build Fablo run: | shellcheck --version && \ yamllint -v && \ npm install && \ ./fablo-build.sh - + - name: Test version 3 - run: e2e-network/docker/test-05-version3.sh - + run: e2e-network/docker/test-05-v3.sh + - uses: actions/upload-artifact@v4 if: always() with: name: test-05-version3 path: | - e2e-network/docker/test-05-version3-snapshot.sh.logs/* - e2e-network/docker/test-05-version3-snapshot.sh.tmpdir/fablo-target/**/* + e2e-network/docker/test-05-v3.sh.logs/* + e2e-network/docker/test-05-v3.sh.tmpdir/fablo-target/**/* test-05-v3-BFT: needs: test-main @@ -226,23 +222,21 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v2 - + - name: Build Fablo run: | shellcheck --version && \ yamllint -v && \ npm install && \ ./fablo-build.sh - + - name: Test version 3 with BFT - run: e2e-network/docker/test-05-version3-BFT.sh - + run: e2e-network/docker/test-06-v3-bft.sh + - uses: actions/upload-artifact@v4 if: always() with: name: test-05-version3-BFT-snapshot path: | - e2e-network/docker/test-05-version3-BFT-snapshot.sh.logs/* - e2e-network/docker/test-05-version3-BFT-snapshot.sh.tmpdir/fablo-target/**/* - - + e2e-network/docker/test-06-v3-bft.sh.logs/* + e2e-network/docker/test-06-v3-bft.sh.tmpdir/fablo-target/**/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index e630d9167..b4c27d5d8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ node_modules .idea .vscode samples/invalid-fablo-config.json -**/.DS_Store \ No newline at end of file +.DS_Store diff --git a/docs/schema.json b/docs/schema.json index f66d2aaae..23b7bd8cb 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -496,13 +496,6 @@ "title": "Chaincode image URI", "type": "string" }, - "port": { - "$id": "#/properties/chaincodes/items/properties/port", - "title": "Chaincode port", - "type": "integer", - "minimum": 10, - "maximum": 65535 - }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "title": "Private data collections", diff --git a/e2e-network/docker/test-01-v2-simple.sh b/e2e-network/docker/test-01-v2-simple.sh index 3c21fc023..2a0ea3093 100755 --- a/e2e-network/docker/test-01-v2-simple.sh +++ b/e2e-network/docker/test-01-v2-simple.sh @@ -81,7 +81,7 @@ expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my- # Reset and ensure the state is lost after reset (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -# waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:get", "name"]}' \ '{\"error\":\"NOT_FOUND\"}' @@ -91,4 +91,4 @@ expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "James Bond"]}' \ '{\"success\":\"OK\"}' -echo "✅ Test passed!" \ No newline at end of file +echo "✅ Test passed!" diff --git a/e2e-network/docker/test-04-v2-snapshot.sh b/e2e-network/docker/test-04-v2-snapshot.sh index b853dc42c..25277b00b 100755 --- a/e2e-network/docker/test-04-v2-snapshot.sh +++ b/e2e-network/docker/test-04-v2-snapshot.sh @@ -9,7 +9,6 @@ FABLO_HOME="$TEST_TMP/../../.." export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json" -CHAINCODE_SRC="$FABLO_HOME/samples/chaincodes/chaincode-kv-node" networkUp() { "$FABLO_HOME/fablo-build.sh" @@ -58,7 +57,6 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" -# waitForContainer "chaincode1_peer0.org1.example.com" "Bootstrap process completed" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" @@ -130,3 +128,5 @@ expectInvokeRest "$fablo_rest_org1 $user_token" "my-channel1" "chaincode1" \ expectInvokeRest "$fablo_rest_org1 $user_token" "my-channel1" "chaincode1" \ "KVContract:getPrivateMessage" '["_implicit_org_Org1MSP"]' \ '{"success":"RHIgVmljdG9yIEZyaWVz"}' + +echo "✅ Test passed!" diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh deleted file mode 100755 index 42d3b5754..000000000 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" -TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" -FABLO_HOME="$TEST_TMP/../../.." - -export FABLO_HOME - -CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json" - -networkUp() { - "$FABLO_HOME/fablo-build.sh" - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) -} - -dumpLogs() { - echo "Saving logs of $1 to $TEST_LOGS/$1.log" - mkdir -p "$TEST_LOGS" - docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 -} - -networkDown() { - rm -rf "$TEST_LOGS" - (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - dumpLogs orderer0.group1.orderer.example.com - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) -} - -waitForContainer() { - sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" -} - -waitForChaincode() { - (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") -} - -expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") -} - -expectCommand() { - sh "$TEST_TMP/../expect-command.sh" "$1" "$2" -} - -trap networkDown EXIT -trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT - -# start the network -networkUp - -waitForContainer "orderer0.group1.orderer.example.com" "Channel created" -waitForContainer "orderer1.group1.orderer.example.com" "Channel created" -waitForContainer "orderer2.group1.orderer.example.com" "Channel created" -waitForContainer "orderer3.group1.orderer.example.com" "Channel created" -waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" -waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" - -# Test simple chaincode -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ - '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' - -# Verify channel query scripts -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) -expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") -expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") -expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," - -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" - -echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/e2e-network/docker/test-05-version3.sh b/e2e-network/docker/test-05-version3.sh deleted file mode 100755 index 5f08f5cf8..000000000 --- a/e2e-network/docker/test-05-version3.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" -TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" -FABLO_HOME="$TEST_TMP/../../.." - -export FABLO_HOME - -CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" - -networkUp() { - "$FABLO_HOME/fablo-build.sh" - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) -} - -dumpLogs() { - echo "Saving logs of $1 to $TEST_LOGS/$1.log" - mkdir -p "$TEST_LOGS" - docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 -} - -networkDown() { - rm -rf "$TEST_LOGS" - (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - dumpLogs orderer0.group1.orderer.example.com - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) -} - -waitForContainer() { - sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" -} - -waitForChaincode() { - (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") -} - -expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") -} - -expectCommand() { - sh "$TEST_TMP/../expect-command.sh" "$1" "$2" -} - -trap networkDown EXIT -trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT - -# start the network -networkUp - -waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" -waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" -waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" - -# Test simple chaincode -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ - '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' - -# Verify channel query scripts -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) -expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") -expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") -expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," - -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" - -echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/src/init/index.ts b/src/init/index.ts index 8def9a41e..1055e4b60 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -119,4 +119,4 @@ export default class InitGenerator extends Generator { console.log("==========================================================="); }); } -} \ No newline at end of file +} diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index 86cc22f48..029c866c5 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -1,47 +1,18 @@ import { sortVersions, version } from "./repositoryUtils"; describe("repositoryUtils", () => { - it("should sort versions", () => { - const unsorted = [ - "0.0.2", - "0.0.2-unstable", - "0.0.1", - "0.1.11", - "0.1.1", - "0.1.1-unstable", - "1.21.2", - ]; + const unsorted = ["0.0.2", "0.0.2-unstable", "0.0.1", "0.1.11", "0.1.1", "0.1.1-unstable", "1.21.2"]; - const expected = [ - "1.21.2", - "0.1.11", - "0.1.1", - "0.0.2", - "0.0.1", - "0.1.1-unstable", - "0.0.2-unstable", - ]; + const expected = ["1.21.2", "0.1.11", "0.1.1", "0.0.2", "0.0.1", "0.1.1-unstable", "0.0.2-unstable"]; expect(sortVersions(unsorted)).toEqual(expected); }); it("should place pre‑release (named) tags after the matching stable tag", () => { - const unsorted = [ - "0.1.1-alpha", - "0.1.1-beta", - "0.1.2-alpha", - "0.1.2", - "0.1.1", - ]; + const unsorted = ["0.1.1-alpha", "0.1.1-beta", "0.1.2-alpha", "0.1.2", "0.1.1"]; - const expected = [ - "0.1.2", - "0.1.1", - "0.1.2-alpha", - "0.1.1-beta", - "0.1.1-alpha", - ]; + const expected = ["0.1.2", "0.1.1", "0.1.2-alpha", "0.1.1-beta", "0.1.1-alpha"]; expect(sortVersions(unsorted)).toEqual(expected); }); @@ -52,7 +23,6 @@ describe("repositoryUtils", () => { expect(sortVersions(unsorted)).toEqual(expected); }); - it("should compare versions", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); @@ -69,14 +39,12 @@ describe("repositoryUtils", () => { expect(version("0.0.1").isGreaterOrEqual("0.0.1-alpha")).toBe(true); }); - it("should check membership with isOneOf()", () => { const list = ["1.2.3", "2.0.0", "3.1.4-alpha"]; expect(version("1.2.3").isOneOf(list)).toBe(true); expect(version("3.1.4").isOneOf(list)).toBe(false); }); - it("should take major.minor fragments only", () => { expect(version("10.5.7").takeMajorMinor()).toBe("10.5"); expect(version("2.0.0-beta").takeMajorMinor()).toBe("2.0"); diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 8c71fb984..71ac171e2 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -250,7 +250,7 @@ networkDown() { <% chaincodes.forEach((chaincode) => { -%> <% chaincode.channel.orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - <% const chaincodeContainerName=`ccaas-` -%> + <% const chaincodeContainerName=`${peer.address}-${chaincode.name}` -%> for container in $(docker ps -a | grep "<%= chaincodeContainerName %>" | awk '{print $1}'); do echo "Removing container $container..."; docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted"; done for image in $(docker images "<%= chaincodeContainerName %>*" -q); do echo "Removing image $image..."; docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted"; done <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 7330ccaa5..e68eca65b 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -15,7 +15,6 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= instance.peerAddress %>" <% -%> "<%= chaincode.name %>" <% -%> "$version" <% -%> - "<%= chaincode.lang %>" <% -%> "<%= chaincode.image %>" <% -%> "<%= instance.port %>" <% -%> "<%= instance.containerName %>" <% -%> @@ -62,7 +61,7 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "$version" <% -%> "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= chaincode.initRequired %>" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> "<%= chaincode.privateDataConfigFile || '' %>" <% -%> "<%= chaincode.lang %>" <% -%> @@ -77,7 +76,7 @@ chaincodeCommit <% -%> "$version" <% -%> "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= chaincode.initRequired %>" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> "<%= chaincode.channel.orgs.map((o) => o.headPeer.fullAddress).join(',') %>" <% -%> "<%= !global.tls ? '' : chaincode.channel.orgs.map(o => `crypto-peer/${o.headPeer.address}/tls/ca.crt`).join(',') %>" <% -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index df5e3489f..66c6d0ca3 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,7 +1,7 @@ networks: basic: -services: +services: <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 2b2fff628..86082ec5f 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -44,9 +44,6 @@ chaincodeBuild() { # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately # and we use `sort -V` to compare versions, because `sort` handles versions like `2.4` and `2.10` correctly - if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then - # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately - # and we use `sort -V` to compare versions, because `sort` handles versions like `2.4` and `2.10` correctly if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" @@ -63,9 +60,6 @@ chaincodeBuild() { NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") - NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") - RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" @@ -113,15 +107,13 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" @@ -133,7 +125,7 @@ chaincodePackageCCaaS() { local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\"type\":\"ccaas\",\"label\":\"$CHAINCODE_LABEL\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" @@ -237,11 +229,9 @@ startCCaaSContainer() { # Extract peer name and organization domain from peer address local PEER_NAME="${PEER_ADDRESS%%:*}" + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\.//') local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # The connection.json expects the container to be accessible on CONTAINER_PORT (17041) - # The container internally listens on 7052, so we map EXTERNAL_PORT:7052 - # This allows the peer to connect to EXTERNAL_PORT and reach the container's 7052 port local PORT_MAP="${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') @@ -286,7 +276,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=${10} - local CHAINCODE_LANG=${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -299,7 +288,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 13be30f3c..d4ab6900e 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -145,7 +145,7 @@ export interface OrgConfig { tools: { fabloRest?: FabloRestConfig; explorer?: ExplorerConfig }; } -export interface peerChaincodeInstances{ +export interface peerChaincodeInstances { containerName: string; peerAddress: string; port: number; diff --git a/src/utils/parseFabloConfig.test.ts b/src/utils/parseFabloConfig.test.ts index 77de1894a..eba214878 100644 --- a/src/utils/parseFabloConfig.test.ts +++ b/src/utils/parseFabloConfig.test.ts @@ -19,21 +19,21 @@ describe("parseFabloConfig", () => { }`; const result = parseFabloConfig(jsonConfig); - + expect(result).toEqual({ global: { fabricVersion: "2.5.9", tls: false, - engine: "docker" + engine: "docker", }, orgs: [ { organization: { name: "Org1", - domain: "org1.example.com" - } - } - ] + domain: "org1.example.com", + }, + }, + ], }); }); @@ -55,16 +55,16 @@ describe("parseFabloConfig", () => { global: { fabricVersion: "2.5.9", tls: false, - engine: "docker" + engine: "docker", }, orgs: [ { organization: { name: "Org1", - domain: "org1.example.com" - } - } - ] + domain: "org1.example.com", + }, + }, + ], }); }); @@ -100,7 +100,7 @@ describe("parseFabloConfig", () => { global: { fabricVersion: "2.4.7", tls: true, - engine: "kubernetes" + engine: "kubernetes", }, orgs: [ { @@ -110,14 +110,14 @@ describe("parseFabloConfig", () => { peers: [ { name: "peer0", - port: 7041 + port: 7041, }, { - name: "peer1", - port: 7042 - } - ] - } + name: "peer1", + port: 7042, + }, + ], + }, }, { organization: { @@ -126,18 +126,18 @@ describe("parseFabloConfig", () => { peers: [ { name: "peer0", - port: 8041 - } - ] - } - } + port: 8041, + }, + ], + }, + }, ], channels: [ { name: "mychannel", - orgs: ["Org1", "Org2"] - } - ] + orgs: ["Org1", "Org2"], + }, + ], }); }); From 858a9033d50c8cc914b1d1bea1f64917076f95d5 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 15:45:21 +0200 Subject: [PATCH 216/471] Snapshots update Signed-off-by: Jakub Dzikowski --- e2e/__snapshots__/extendConfig.test.ts.snap | 70 +++--- ...1chaincode-raft-explorer.json.test.ts.snap | 190 +++++++++------ ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 190 +++++++++------ ...2chaincodes-private-data.yaml.test.ts.snap | 224 +++++++++++------- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 204 +++++++++------- ...1chaincode-raft-explorer.json.test.ts.snap | 190 +++++++++------ ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 215 +++++++++++++++-- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 215 +++++++++++++++-- e2e/__snapshots__/fabloCommands.test.ts.snap | 75 +++--- e2e/__snapshots__/schema.test.ts.snap | 7 - e2e/fabloCommands.test.ts | 2 +- 11 files changed, 1079 insertions(+), 503 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 4471afb19..b99e83c25 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -2223,12 +2223,12 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "engine": "docker", "fabricBaseosVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.3.3", - "fabricJavaenvVersion": "2.3", - "fabricNodeenvVersion": "2.3", - "fabricRecommendedNodeVersion": "12", - "fabricToolsVersion": "2.3.3", - "fabricVersion": "2.3.3", + "fabricCcenvVersion": "2.5.12", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.12", + "fabricVersion": "2.5.12", "monitoring": { "loglevel": "info", }, @@ -9445,6 +9445,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND ('Org1MSP.member')", + "image": undefined, "init": "{"Args":[]}", "instantiatingOrg": { "anchorPeers": [ @@ -9535,6 +9536,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -10403,6 +10405,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND ('Org1MSP.member')", + "image": undefined, "init": "{"Args":[]}", "instantiatingOrg": { "anchorPeers": [ @@ -10493,6 +10496,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "lang": "node", "name": "chaincode1", + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11099,7 +11103,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11129,7 +11133,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11146,7 +11150,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11241,7 +11245,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11271,7 +11275,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11288,7 +11292,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11318,6 +11322,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11329,7 +11334,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11359,7 +11364,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11376,7 +11381,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11403,6 +11408,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11420,7 +11426,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11450,7 +11456,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11467,7 +11473,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11562,7 +11568,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11592,7 +11598,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11609,7 +11615,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11640,21 +11646,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "global": { "capabilities": { - "application": "V2_0", + "application": "V2_5", "channel": "V2_0", "isV2": true, "isV3": false, "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "2.3.3", + "fabricBaseosVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.3.3", - "fabricJavaenvVersion": "2.3", - "fabricNodeenvVersion": "2.3", - "fabricRecommendedNodeVersion": "12", - "fabricToolsVersion": "2.3.3", - "fabricVersion": "2.3.3", + "fabricCcenvVersion": "2.5.12", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.12", + "fabricVersion": "2.5.12", "monitoring": { "loglevel": "info", }, @@ -11809,7 +11815,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11839,7 +11845,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11856,7 +11862,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 2ed0d4fa8..35df2c25b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1538,8 +1538,8 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info -FABRIC_VERSION=2.3.3 -FABRIC_TOOLS_VERSION=2.3.3 +FABRIC_VERSION=2.5.12 +FABRIC_TOOLS_VERSION=2.5.12 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.12 @@ -1770,7 +1770,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1831,19 +1831,19 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2238,9 +2238,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' @@ -2519,7 +2541,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2540,7 +2561,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2585,7 +2605,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2619,56 +2638,53 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2703,48 +2719,77 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" docker run -d \\ --name "$CONTAINER_NAME" \\ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ -e CORE_CHAINCODE_LOGGING_SHIM=info \\ -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ -p "$PORT_MAP" \\ --network "$NETWORK" \\ "$CHAINCODE_IMAGE" @@ -2762,7 +2807,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2775,7 +2819,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2807,13 +2850,10 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 9e0d26142..7a937889a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1726,7 +1726,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1788,27 +1788,27 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2107,9 +2107,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' @@ -2388,7 +2410,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2409,7 +2430,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2454,7 +2474,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2488,56 +2507,53 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2572,48 +2588,77 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" docker run -d \\ --name "$CONTAINER_NAME" \\ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ -e CORE_CHAINCODE_LOGGING_SHIM=info \\ -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ -p "$PORT_MAP" \\ --network "$NETWORK" \\ "$CHAINCODE_IMAGE" @@ -2631,7 +2676,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2644,7 +2688,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2676,13 +2719,10 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 0a2c1ce59..c36663da8 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2408,10 +2408,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" else @@ -2460,10 +2460,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2484,9 +2484,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "or-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'or-policy-chaincode' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" printHeadline "Approving 'or-policy-chaincode' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2494,9 +2494,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "and-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'and-policy-chaincode' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" printHeadline "Approving 'and-policy-chaincode' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2542,10 +2542,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2583,59 +2583,59 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -3035,9 +3035,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' @@ -3316,7 +3338,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -3337,7 +3358,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -3382,7 +3402,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -3416,56 +3435,53 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -3500,48 +3516,77 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" docker run -d \\ --name "$CONTAINER_NAME" \\ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ -e CORE_CHAINCODE_LOGGING_SHIM=info \\ -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ -p "$PORT_MAP" \\ --network "$NETWORK" \\ "$CHAINCODE_IMAGE" @@ -3559,7 +3604,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -3572,7 +3616,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -3604,13 +3647,10 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 9eeeb2dc7..2ea46ef82 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3598,9 +3598,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printHeadline "Approving 'chaincode1' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "" "" @@ -3608,9 +3608,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode2" ]; then local version="0.0.1" printHeadline "Approving 'chaincode2' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printHeadline "Approving 'chaincode2' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "" "" @@ -3707,43 +3707,43 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org2.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org2.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org2.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -4438,9 +4438,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' @@ -4719,7 +4741,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -4740,7 +4761,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -4785,7 +4805,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -4819,56 +4838,53 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -4903,48 +4919,77 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" docker run -d \\ --name "$CONTAINER_NAME" \\ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ -e CORE_CHAINCODE_LOGGING_SHIM=info \\ -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ -p "$PORT_MAP" \\ --network "$NETWORK" \\ "$CHAINCODE_IMAGE" @@ -4962,7 +5007,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -4975,7 +5019,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -5007,13 +5050,10 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 123b5783f..97249883d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3894,7 +3894,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -3965,27 +3965,27 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -4938,9 +4938,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' @@ -5219,7 +5241,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -5240,7 +5261,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -5285,7 +5305,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -5319,56 +5338,53 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -5403,48 +5419,77 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" docker run -d \\ --name "$CONTAINER_NAME" \\ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ -e CORE_CHAINCODE_LOGGING_SHIM=info \\ -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ -p "$PORT_MAP" \\ --network "$NETWORK" \\ "$CHAINCODE_IMAGE" @@ -5462,7 +5507,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -5475,7 +5519,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -5507,13 +5550,10 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 463d70724..e24f006bb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1760,9 +1760,9 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1790,9 +1790,9 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1826,9 +1826,9 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1854,27 +1854,27 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2208,6 +2208,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2257,6 +2259,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2314,6 +2318,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2590,7 +2635,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2611,7 +2655,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2656,7 +2699,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2684,6 +2726,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2707,6 +2813,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2762,6 +2944,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 0f7b9b68f..018f9b842 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1784,9 +1784,9 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1814,9 +1814,9 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1850,9 +1850,9 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1878,27 +1878,27 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2232,6 +2232,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2281,6 +2283,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2338,6 +2342,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2614,7 +2659,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2635,7 +2679,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2680,7 +2723,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2708,6 +2750,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2731,6 +2837,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2786,6 +2968,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 452e4ca80..2021de2b9 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,9 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Validation errors count: 0 +Validation warnings count: 0 +=========================================================== { "global": { "fabricVersion": "2.4.3", @@ -2471,18 +2474,26 @@ Validation warnings count: 0 exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 -Validation warnings count: 0 +Validation warnings count: 1 +=========================================================== +Validation errors count: 0 +Validation warnings count: 1 +=========================================================== +=================== Validation summary ==================== +Warnings found: + Orderer: + - Orderer consesus type is set to 'raft', but number of instances is 1. Network won't be fault tolerant! Consider higher value. =========================================================== { "global": { - "fabricVersion": "2.5.9", - "tls": false, + "fabricVersion": "2.5.12", + "tls": true, "peerDevMode": false, "engine": "docker", - "fabricToolsVersion": "2.5.9", + "fabricToolsVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.5.9", - "fabricBaseosVersion": "2.5.9", + "fabricCcenvVersion": "2.5.12", + "fabricBaseosVersion": "2.5.12", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", @@ -2505,7 +2516,7 @@ Validation warnings count: 0 "ordererGroups": [ { "name": "group1", - "consensus": "solo", + "consensus": "etcdraft", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2519,7 +2530,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2532,7 +2543,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2544,7 +2555,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2558,7 +2569,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2590,7 +2601,7 @@ Validation warnings count: 0 "ordererGroups": [ { "name": "group1", - "consensus": "solo", + "consensus": "etcdraft", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2604,7 +2615,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2617,7 +2628,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2810,7 +2821,7 @@ Validation warnings count: 0 ], "ordererGroup": { "name": "group1", - "consensus": "solo", + "consensus": "etcdraft", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2824,7 +2835,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2837,7 +2848,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2849,7 +2860,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2861,7 +2872,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2969,8 +2980,8 @@ exports[`init should init simple fablo config 1`] = ` "{ "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { - "fabricVersion": "2.5.9", - "tls": false, + "fabricVersion": "2.5.12", + "tls": true, "peerDevMode": false, "engine": "docker" }, @@ -2988,7 +2999,7 @@ exports[`init should init simple fablo config 1`] = ` "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1, "prefix": "orderer" } @@ -3037,8 +3048,8 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "{ "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { - "fabricVersion": "2.5.9", - "tls": false, + "fabricVersion": "2.5.12", + "tls": true, "peerDevMode": false, "engine": "docker" }, @@ -3056,7 +3067,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1, "prefix": "orderer" } @@ -3100,9 +3111,9 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "privateData": [] } ], @@ -3114,8 +3125,8 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "{ "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { - "fabricVersion": "2.5.9", - "tls": false, + "fabricVersion": "2.5.12", + "tls": true, "peerDevMode": false, "engine": "docker" }, @@ -3133,7 +3144,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1, "prefix": "orderer" } @@ -3181,9 +3192,9 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "privateData": [] } ], diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6cbed0b92..8bbbc9bed 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -104,13 +104,6 @@ exports[`schema should match snapshot 1`] = ` "title": "Name", "type": "string", }, - "port": { - "$id": "#/properties/chaincodes/items/properties/port", - "maximum": 65535, - "minimum": 10, - "title": "Chaincode port", - "type": "integer", - }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "items": { diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 361c0c3f4..1a4a1d840 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -82,7 +82,7 @@ describe("validate", () => { // Then expect(commandResult).toEqual(TestCommands.success()); expect(commandResult.output).toContain("Validation errors count: 0"); - expect(commandResult.output).toContain("Validation warnings count: 0"); + expect(commandResult.output).toContain("Validation warnings count: 1"); expect(commands.getFiles()).toContain("e2e/__tmp__/commands-tests/fablo-config.json"); }); From 54cee6058ef37ba979f2ca37c7e92def0d980ec0 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Jul 2025 11:19:39 +0200 Subject: [PATCH 217/471] ensure read access for generated certs Signed-off-by: Jakub Dzikowski --- ...o-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 1 + .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 1 + ...-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 1 + .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 1 + ...-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 1 + .../templates/fabric-docker/scripts/base-functions-v2.sh | 1 + 6 files changed, 6 insertions(+) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 35df2c25b..60fbc4fe7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2268,6 +2268,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 7a937889a..ad8db2407 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2137,6 +2137,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index c36663da8..9a7de467b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3065,6 +3065,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 2ea46ef82..272e50f60 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4468,6 +4468,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 97249883d..8e3a9c693 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4968,6 +4968,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 966e52363..7f0f3758f 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -98,6 +98,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" } From a9e67689967c1cd798200320e931d5d5912d7c29 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 21 Jul 2025 10:48:02 +0200 Subject: [PATCH 218/471] Use chown instead of chmod to handle permission errors Signed-off-by: Jakub Dzikowski --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../templates/fabric-docker/scripts/base-functions-v2.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 60fbc4fe7..dae1bfba9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2268,7 +2268,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ad8db2407..4797fa07f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2137,7 +2137,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 9a7de467b..84b107a08 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3065,7 +3065,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 272e50f60..ebf87e7cd 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4468,7 +4468,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 8e3a9c693..6047081ae 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4968,7 +4968,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 7f0f3758f..051bd5dc1 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -98,7 +98,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" } From 5d8505070d695cf07188ed4457fa9b846e221982 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 21 Jul 2025 11:06:56 +0200 Subject: [PATCH 219/471] Move the chown inside alpine container Signed-off-by: Jakub Dzikowski --- ...onfig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 4 ++-- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 4 ++-- ...nfig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 4 ++-- ...fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 4 ++-- ...nfig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 4 ++-- .../templates/fabric-docker/scripts/base-functions-v2.sh | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index dae1bfba9..2c92311a5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2264,11 +2264,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 4797fa07f..08d024384 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2133,11 +2133,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 84b107a08..8ab5545af 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3061,11 +3061,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index ebf87e7cd..1da15b112 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4464,11 +4464,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 6047081ae..1b6a932ab 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4964,11 +4964,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 051bd5dc1..fa5215a18 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -94,11 +94,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" } From 37fa476504be12315257d6b97b81a4e6b5149580 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 25 Jul 2025 11:44:49 +0200 Subject: [PATCH 220/471] Update fablo config to use CCaaS and add todos Signed-off-by: Jakub Dzikowski --- samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 4 ++-- .../templates/fabric-docker/commands-generated.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 71969cf3d..c07880f57 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -55,9 +55,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" } ], "hooks": { diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 71ac171e2..e3e207ebf 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -28,6 +28,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -241,6 +243,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } From 9e5c9024bccc8baf51619aab11f8dfa8165e02e9 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 1 Aug 2025 04:07:02 -0500 Subject: [PATCH 221/471] Fix-ccaas-without-TLS Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 66c6d0ca3..534e4cc95 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -285,9 +285,9 @@ services: <%_ if(peer.gatewayEnabled) { _%> # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + <%_ } _%> # ccaas builder configuration - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"<%= peer.name %><%= org.name %>"} - <%_ } _%> working_dir: /etc/hyperledger/fabric/peer/ command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> ports: From 92cc7f260c937ac926726420d7ebc1051301a445 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Tue, 12 Aug 2025 07:36:58 -0500 Subject: [PATCH 222/471] fix-start chaincodes after restore Signed-off-by: Pereowei Daniel --- README.md | 1 + e2e-network/docker/test-04-v2-snapshot.sh | 1 + e2e/__snapshots__/extendConfig.test.ts.snap | 30 ++++++++++---- ...1chaincode-raft-explorer.json.test.ts.snap | 40 +++++++++++-------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 3 ++ ...2chaincodes-private-data.yaml.test.ts.snap | 3 ++ ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 3 ++ ...1chaincode-raft-explorer.json.test.ts.snap | 15 +++++++ ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 3 ++ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 3 ++ 10 files changed, 77 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 999f16bb6..cc2604f79 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ Example: 3. Execute `./fablo prune` to destroy the current network. If the network was present, Fablo would not be able to restore the new one from backup. 4. Execute `./fablo restore /tmp/my-snapshot` to restore the network. 5. Execute `./fablo start` to start the restored network. +6. When running external chaincodes(CCAAS), Execute `./fablo chaincodes install` to start the CCAAS container Typically, a snapshot of the network with little data will take less than 1 MB, so it is easy to share. diff --git a/e2e-network/docker/test-04-v2-snapshot.sh b/e2e-network/docker/test-04-v2-snapshot.sh index 25277b00b..7258aa48d 100755 --- a/e2e-network/docker/test-04-v2-snapshot.sh +++ b/e2e-network/docker/test-04-v2-snapshot.sh @@ -112,6 +112,7 @@ hook_command="perl -i -pe 's/FABRIC_VERSION=2\.3\.3/FABRIC_VERSION=2\.4\.2/g' ./ "$FABLO_HOME/fablo.sh" prune && "$FABLO_HOME/fablo.sh" restore "$snapshot_name" "$hook_command" && "$FABLO_HOME/fablo.sh" start + "$FABLO_HOME/fablo.sh" chaincodes install ) waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index b99e83c25..6b22c573d 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1888,9 +1888,9 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1974,9 +1974,16 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "peerChaincodeInstances": [], + "peerChaincodeInstances": [ + { + "containerName": "ccaas-peer0.org1.example.com-chaincode1", + "orgDomain": "org1.example.com", + "peerAddress": "peer0.org1.example.com", + "port": 17041, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11320,9 +11327,9 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11406,9 +11413,16 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "peerChaincodeInstances": [], + "peerChaincodeInstances": [ + { + "containerName": "ccaas-peer0.org1.example.com-chaincode1", + "orgDomain": "org1.example.com", + "peerAddress": "peer0.org1.example.com", + "port": 17041, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 2c92311a5..ea378e6c1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1699,6 +1699,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1714,18 +1716,19 @@ installChannels() { } installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" fi } @@ -1744,18 +1747,19 @@ installChaincode() { fi if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" fi fi } @@ -1791,18 +1795,19 @@ upgradeChaincode() { fi if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" fi fi } @@ -1826,6 +1831,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -1909,7 +1915,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: - basic @@ -2022,7 +2028,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: - basic diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 08d024384..cd90c2ebd 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,6 +1651,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1783,6 +1785,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 8ab5545af..0dfa5bd32 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2365,6 +2365,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -2578,6 +2580,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 1da15b112..8cf0515ec 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3467,6 +3467,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3702,6 +3704,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 1b6a932ab..3b969904c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3801,6 +3801,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3960,6 +3962,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -4303,6 +4306,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4350,6 +4355,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4532,6 +4539,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4579,6 +4588,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4761,6 +4772,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4808,6 +4821,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index e24f006bb..14261a8a1 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1731,6 +1731,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1849,6 +1851,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 018f9b842..5fbe2384d 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1756,6 +1756,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1873,6 +1875,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } From 67919315773cda6ac54b0577ce7c8b3a7ef47a93 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Tue, 12 Aug 2025 07:59:34 -0500 Subject: [PATCH 223/471] fix-update test suites Signed-off-by: Pereowei Daniel --- ...hlf2-1org-1chaincode-k8s.json.test.ts.snap | 26 -------- ...1chaincode-raft-explorer.json.test.ts.snap | 32 ++------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 28 +------- ...2chaincodes-private-data.yaml.test.ts.snap | 36 +--------- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 65 +------------------ ...1chaincode-raft-explorer.json.test.ts.snap | 63 ++---------------- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 28 +------- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 28 +------- 8 files changed, 13 insertions(+), 293 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 98925532a..7cff81ecf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -482,31 +482,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -517,6 +492,5 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/chaincode-functions.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/util.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b40924c24..ea378e6c1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1527,7 +1527,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -2129,14 +2129,14 @@ services: - basic db.explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" + test: "pg_isready -h localhost -p 5432 -q -U postgres" interval: 5s timeout: 10s retries: 7 @@ -2146,7 +2146,7 @@ services: - basic explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: @@ -3490,29 +3490,6 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - postgres] - Org1_peer0[Peer: peer0] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3541,6 +3518,5 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ef75fd6ae..cd90c2ebd 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1438,7 +1438,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3355,31 +3355,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3406,6 +3381,5 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper fil "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5ebb8feee..3128ff3e2 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2099,7 +2099,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -4285,39 +4285,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Org_Org2 [Org: Org2] - CA_ca_Org2[CA: ca_Org2 - sqlite] - Org2_peer0[Peer: peer0] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_or_policy_chaincode[Chaincode: or-policy-chaincode] - Chaincode_and_policy_chaincode[Chaincode: and-policy-chaincode] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 - Org_Org2 -.-> Channel_my_channel1 - Org2_peer0 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -4350,6 +4317,5 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 7cb0a10be..8cf0515ec 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3022,7 +3022,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -5695,68 +5695,6 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; -exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"graph TD - - subgraph Org_Orderer1 [Org: Orderer1] - CA_ca_Orderer1[CA: ca_Orderer1 - sqlite] - end - - subgraph Org_Orderer2 [Org: Orderer2] - CA_ca_Orderer2[CA: ca_Orderer2 - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Org_Org2 [Org: Org2] - CA_ca_Org2[CA: ca_Org2 - sqlite] - Org2_peer0[Peer: peer0] - Org2_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - subgraph Channel_my_channel2 [Channel: my-channel2] - Chaincode_chaincode2[Chaincode: chaincode2] - end - - subgraph Channel_my_channel3 [Channel: my-channel3] - end - - %% Connections - Org_Orderer1 --> Channel_my_channel1 - Org_Orderer1 --> Channel_my_channel2 - Org_Orderer1 --> Channel_my_channel3 - Org_Orderer2 --> Channel_my_channel1 - Org_Orderer2 --> Channel_my_channel2 - Org_Orderer2 --> Channel_my_channel3 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 - Org_Org2 -.-> Channel_my_channel1 - Org2_peer0 --> Channel_my_channel1 - Org2_peer1 --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel2 - Org1_peer0 --> Channel_my_channel2 - Org1_peer1 --> Channel_my_channel2 - Org_Org2 -.-> Channel_my_channel2 - Org2_peer0 --> Channel_my_channel2 - Org2_peer1 --> Channel_my_channel2 - Org_Org1 -.-> Channel_my_channel3 - Org1_peer0 --> Channel_my_channel3 - Org1_peer1 --> Channel_my_channel3 - Org_Org2 -.-> Channel_my_channel3 - Org2_peer0 --> Channel_my_channel3 - Org2_peer1 --> Channel_my_channel3 -" -`; - exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -5791,6 +5729,5 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index a8770b215..3b969904c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3317,7 +3317,7 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -4838,14 +4838,14 @@ services: - basic db.explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" + test: "pg_isready -h localhost -p 5432 -q -U postgres" interval: 5s timeout: 10s retries: 7 @@ -4855,7 +4855,7 @@ services: - basic explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: @@ -6211,60 +6211,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Org_Org2 [Org: Org2] - CA_ca_Org2[CA: ca_Org2 - sqlite] - Org2_peer0[Peer: peer0] - Org2_peer1[Peer: peer1] - end - - subgraph Org_Org3 [Org: Org3] - CA_ca_Org3[CA: ca_Org3 - sqlite] - Org3_peer0[Peer: peer0] - Org3_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - subgraph Channel_my_channel2 [Channel: my-channel2] - end - - subgraph Channel_my_channel3 [Channel: my-channel3] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Orderer --> Channel_my_channel2 - Org_Orderer --> Channel_my_channel3 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 - Org_Org2 -.-> Channel_my_channel2 - Org2_peer0 --> Channel_my_channel2 - Org2_peer1 --> Channel_my_channel2 - Org_Org1 -.-> Channel_my_channel3 - Org1_peer0 --> Channel_my_channel3 - Org1_peer1 --> Channel_my_channel3 - Org_Org2 -.-> Channel_my_channel3 - Org2_peer0 --> Channel_my_channel3 - Org2_peer1 --> Channel_my_channel3 -" -`; - exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -6303,6 +6249,5 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 4f82f5e54..14261a8a1 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1514,7 +1514,7 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2 "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3582,31 +3582,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3633,6 +3608,5 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper fi "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 3cd4231fe..45c40bd14 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1539,7 +1539,7 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3606,31 +3606,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3657,6 +3632,5 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; From bdc421c52d18fde0fa8f1826176f914971de0568 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 14 Aug 2025 17:02:49 -0500 Subject: [PATCH 224/471] feat-update-coverage-tracker Signed-off-by: Pereowei Daniel --- COVERAGE_TRACKER.md | 2 +- ...hlf2-1org-1chaincode-k8s.json.test.ts.snap | 26 + ...1chaincode-raft-explorer.json.test.ts.snap | 3521 +---------------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 263 +- ...2chaincodes-private-data.yaml.test.ts.snap | 313 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 336 +- ...1chaincode-raft-explorer.json.test.ts.snap | 300 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 244 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 244 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 63 +- .../fabric-docker/commands-generated.sh | 3 - 11 files changed, 407 insertions(+), 4908 deletions(-) diff --git a/COVERAGE_TRACKER.md b/COVERAGE_TRACKER.md index b35fcbff6..80ad1d8fe 100644 --- a/COVERAGE_TRACKER.md +++ b/COVERAGE_TRACKER.md @@ -22,7 +22,7 @@ This document provides an overview of Fablo features. The table below tracks fea | Node | ✓ | ✓ | | | | | Go | ✓ | ✓ | | | | | Java | ✓ | ✓ | | | | -| Chaincode-as-a-Service (CCaaS) | ✕ | ✕ | | | | +| Chaincode-as-a-Service (CCaaS) | ✓ | ✕ | | [04_v2](/e2e-network/docker/test-04-v2-snapshot.sh) | | | Endorsement Policies | ✓ | ✓ | | | | | Multi-org Endorsements | ✓ | ✓ | | | | | Private Data Collections | ✓ | ✓ | | | | diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 7cff81ecf..98925532a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -482,6 +482,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -492,5 +517,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/chaincode-functions.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/util.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index ea378e6c1..b79c8f74e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3522 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"/config -/crypto-config -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"################################################################################ -# SECTION: Capabilities -################################################################################ -Capabilities: - Channel: &ChannelCapabilities - V2_0: true - Orderer: &OrdererCapabilities - V2_0: true - Application: &ApplicationCapabilities - V2_5: true - -################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - EtcdRaft: - Consenters: - - Host: orderer0.group1.orderer.example.com - Port: 7030 - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 1 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Orderer - - *Org1 - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *ApplicationCapabilities - Consortium: SampleConsortium - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-orderer", - "description": "Connection profile for Orderer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Orderer" - }, - "organizations": { - "Orderer": { - "mspid": "OrdererMSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.orderer.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.orderer.example.com": { - "url": "https://localhost:7020", - "caName": "ca.orderer.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-orderer -description: Connection profile for Orderer in Fablo network -version: 1.0.0 -client: - organization: Orderer -organizations: - Orderer: - mspid: OrdererMSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.orderer.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.orderer.example.com: - url: https://localhost:7020 - caName: ca.orderer.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Org1 in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1" - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.org1.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.org1.example.com": { - "url": "https://localhost:7040", - "caName": "ca.org1.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-org1 -description: Connection profile for Org1 in Fablo network -version: 1.0.0 -client: - organization: Org1 -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.org1.example.com: - url: https://localhost:7040 - caName: ca.org1.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - Template: - Count: 0 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Org1 - Domain: org1.example.com - Specs: - Template: - Count: 1 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Hyperledger Explorer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1", - "tlsEnable": true, - "enableAuthentication": true, - "adminCredential": { - "id": "admin", - "password": "adminpw" - }, - "connection": { - "timeout": { - "peer": { - "endorser": "300" - }, - "orderer": "300" - } - } - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "adminPrivateKey": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" - }, - "peers": [ - "peer0.org1.example.com" - ], - "signedCert": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" - } - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://peer0.org1.example.com:7041", - "tlsCACerts": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" - } - } - }, - "channels": { - "my-channel1": { - "peers": {} - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - orderer: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - org1: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - notifyOrgsAboutChannels - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "\${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "\${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.2.0 -FABLO_BUILD= -FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 - -COUCHDB_VERSION=3.1 -FABRIC_COUCHDB_VERSION=0.4.18 - -FABLO_CONFIG= -CHAINCODES_BASE_DIR= - -COMPOSE_PROJECT_NAME= -LOGGING_LEVEL=info - -FABRIC_VERSION=2.5.12 -FABRIC_TOOLS_VERSION=2.5.12 -FABRIC_CA_VERSION=1.5.5 -FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=2.5.12 -FABRIC_BASEOS_VERSION=2.5.12 -FABRIC_JAVAENV_VERSION=2.5 -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=16 - -ROOT_CA_ADMIN_NAME=admin -ROOT_CA_ADMIN_PASSWORD=adminpw - -ORDERER_CA_ADMIN_NAME=admin -ORDERER_CA_ADMIN_PASSWORD=adminpw - -ORG1_CA_ADMIN_NAME=admin -ORG1_CA_ADMIN_PASSWORD=adminpw - -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -chaincodeList() { - if [ "$#" -ne 2 ]; then - echo "Expected 2 parameters for chaincode list, but got: $*" - exit 1 - - elif [ "$1" = "peer0.org1.example.com" ]; then - - peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - - else - - echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" - exit 1 - - fi -} - -# Function to perform chaincode invoke. Accepts 5 parameters: -# 1. comma-separated peers -# 2. channel name -# 3. chaincode name -# 4. chaincode command -# 5. transient data (optional) -chaincodeInvoke() { - if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then - echo "Expected 4 or 5 parameters for chaincode list, but got: $*" - echo "Usage: fablo chaincode invoke [transient]" - exit 1 - fi - - # Cli needs to be from the same org as the first peer - if [[ "$1" == "peer0.org1.example.com"* ]]; then - cli="cli.org1.example.com" - fi - - peer_addresses="$1" - peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" - - peer_certs="$1" - peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" - - if [ "$2" = "my-channel1" ]; then - ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" - fi - peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" - -set -eu - -channelQuery() { - if [ "$#" -eq 1 ]; then - printChannelsHelp - - elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then - - peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif - - [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] - then - - peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - TARGET_FILE=\${6:-"$channel-config.json"} - - peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - BLOCK_NAME=$2 - TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - - peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - - else - - echo "$@" - echo "$1, $2, $3, $4, $5, $6, $7, $#" - printChannelsHelp - fi - -} - -printChannelsHelp() { - echo "Channel management commands:" - echo "" - - echo "fablo channel list org1 peer0" - echo -e "\\t List channels on 'peer0' of 'Org1'". - echo "" - - echo "fablo channel getinfo my-channel1 org1 peer0" - echo -e "\\t Get channel info on 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" - echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch my-channel1 org1 peer0 [file name]" - echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -generateArtifacts() { - printHeadline "Generating basic configs" "U1F913" - - printItalics "Generating crypto material for Orderer" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating crypto material for Org1" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating genesis block for group group1" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - - # Create directories to avoid permission errors on linux - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -startNetwork() { - printHeadline "Starting network" "U1F680" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts - sleep 4 -} - -generateChannelsArtifacts() { - printHeadline "Generating config for 'my-channel1'" "U1F913" - createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -installChannels() { - printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - -} - -installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - local version="0.0.1" - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - else - echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - -} - -installChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - fi -} - -runDevModeChaincode() { - local chaincodeName=$1 - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - local version="0.0.1" - printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" - - fi -} - -upgradeChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - fi -} - -notifyOrgsAboutChannels() { - - printHeadline "Creating new channel config blocks" "U1F537" - createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" - - printHeadline "Notyfing orgs about channels" "U1F4E2" - notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - printHeadline "Deleting new channel config blocks" "U1F52A" - deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" - -} - -printStartSuccessInfo() { - printHeadline "Done! Enjoy your fresh network" "U1F984" -} - -stopNetwork() { - printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) - sleep 4 -} - -networkDown() { - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do - echo "Removing container $container..." - docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" - done - for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do - echo "Removing image $image..." - docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" - done - - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - - printf "Removing generated configs... \\U1F5D1 \\n" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - - printHeadline "Done! Network was purged" "U1F5D1" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Genesis file configuration (for solo and raft) - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_DB_TLS_ENABLED=false - - FABRIC_CA_SERVER_DB_TYPE=postgres - - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - depends_on: - db.ca.org1.example.com: - condition: service_healthy - networks: - - basic - - db.ca.org1.example.com: - container_name: db.ca.org1.example.com - image: postgres:\${FABRIC_CA_POSTGRES_VERSION} - environment: - - POSTGRES_PASSWORD=caDbPass12345 - - POSTGRES_USER=postgres - - POSTGRES_DB=fabriccaserver - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - fablo-rest.org1.example.com: - container_name: fablo-rest.org1.example.com - image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} - environment: - - PORT=8000 - - MSP_ID=Org1MSP - - FABRIC_CA_URL=https://ca.org1.example.com:7054 - - FABRIC_CA_NAME=ca.org1.example.com - - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 - - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - HFC_LOGGING={"error":"console","warn":"console","info":"console"} - volumes: - # note: fablo needs access to all anchor peer certs - - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro - ports: - - 8801:8000 - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - depends_on: - couchdb.peer0.org1.example.com: - condition: service_healthy - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: couchdb:\${COUCHDB_VERSION} - environment: - - COUCHDB_USER=peer0 - - COUCHDB_PASSWORD=peer0Password - healthcheck: - test: "curl -f http://localhost:5984/" - interval: 5s - timeout: 10s - retries: 7 - ports: - - 5100:5984 - networks: - - basic - - db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} - container_name: db.explorer.example.com - environment: - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWORD=password - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} - restart: on-failure:8 - container_name: explorer.example.com - environment: - - DATABASE_HOST=db.explorer.example.com - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWD=password - - LOG_LEVEL_APP=debug - - LOG_LEVEL_DB=debug - - LOG_LEVEL_CONSOLE=info - - LOG_CONSOLE_STDOUT=true - - DISCOVERY_AS_LOCALHOST=false - volumes: - - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json - - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile - - ../fabric-config/crypto-config:/tmp/crypto - ports: - - "7010:8080" - depends_on: - db.explorer.example.com: - condition: service_healthy - networks: - - basic -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -certsGenerate() { - local CONTAINER_NAME=certsGenerate - - local CONFIG_PATH=$1 - local CRYPTO_CONFIG_FILE_NAME=$2 - local ORG_PATH=$3 - local OUTPUT_PATH=$4 - local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH - - echo "Generating certs..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" - inputLog "ORG_PATH: $ORG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" - - if [ -d "$FULL_CERT_PATH" ]; then - echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME - - docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME - - # shellcheck disable=2044 - for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do - dir=$(dirname "$file") - mv "\${dir}"/*_sk "\${dir}"/priv-key.pem - done -} - -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - - # Create openssl config with SANs - cat > /certs/openssl.cnf << EOF -[req] -distinguished_name = req_distinguished_name -req_extensions = v3_req -prompt = no - -[req_distinguished_name] -CN = '"$CONTAINER_NAME"' - -[v3_req] -basicConstraints = CA:FALSE -keyUsage = nonRepudiation, digitalSignature, keyEncipherment -subjectAltName = @alt_names - -[alt_names] -DNS.1 = '"$CONTAINER_NAME"' -DNS.2 = localhost -IP.1 = 127.0.0.1 -EOF - - openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - -genesisBlockCreate() { - local CONTAINER_NAME=genesisBlockCreate - - local CONFIG_PATH=$1 - local OUTPUT_PATH=$2 - local GENESIS_PROFILE_NAME=$3 - local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block - - echo "Creating genesis block..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" - inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" - - if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then - echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME - - mkdir -p "$OUTPUT_PATH" - docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createChannelTx() { - local CONTAINER_NAME=createChannelTx - - local CHANNEL_NAME=$1 - local CONFIG_PATH=$2 - local CONFIG_PROFILE=$3 - local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx - - echo "Creating channelTx for $CHANNEL_NAME..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" - - if [ -f "$CHANNEL_TX_PATH" ]; then - echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createNewChannelUpdateTx() { - local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CONFIG_PROFILE=$3 - local CONFIG_PATH=$4 - local OUTPUT_PATH=$5 - - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then - echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen \\ - --configPath ./fabric-config \\ - -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ - -channelID "\${CHANNEL_NAME}" \\ - -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - - docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -notifyOrgAboutNewChannel() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -notifyOrgAboutNewChannelTls() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - local CA_CERT="/var/hyperledger/cli/"\${6} - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" \\ - --tls --cafile "$CA_CERT" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -deleteNewChannelUpdateTx() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" - inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -printHeadline() { - bold=$'\\e[1m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -printItalics() { - italics=$'\\e[3m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -inputLog() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -inputLogShort() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -certsRemove() { - local CERTS_DIR_PATH=$1 - rm -rf "$CERTS_DIR_PATH" -} - -removeContainer() { - CONTAINER_NAME=$1 - docker rm -f "$CONTAINER_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -printHelp() { - echo "Fablo is powered by SoftwareMill" - - echo "" - echo "usage: ./fabric-docker.sh " - echo "" - - echo "Commands: " - echo "" - echo "./fabric-docker.sh up" - echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." - echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" - echo "" - echo "./fabric-docker.sh down" - echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." - echo "" - echo "./fabric-docker.sh start" - echo -e "\\t Starts already created network." - echo "" - echo "./fabric-docker.sh stop" - echo -e "\\t Stops already running network." - echo "" - echo "./fabric-docker.sh reset" - echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." - echo "" - echo "./fabric-docker.sh channel --help" - echo -e "\\t Detailed help for channel management scripts." - echo "" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash -# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. -# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u - -dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" - fi -} - -node_version_check() { - local fabric_shim_version="$1" - local nodejs_version - - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 - - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 - - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 - - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 - - else - nodejs_version=18.12 - fi - - echo $nodejs_version -} - -chaincodeBuild() { - local CHAINCODE_NAME=$1 - local CHAINCODE_LANG=$2 - local CHAINCODE_DIR_PATH=$3 - local RECOMMENDED_NODE_VERSION=$4 - - mkdir -p "$CHAINCODE_DIR_PATH" - - # pull required images upfront in case of arm64 (Apple Silicon) architecture - # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately - # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly - if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then - if [ "$CHAINCODE_LANG" = "node" ]; then - dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "java" ]; then - dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "golang" ]; then - dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" - fi - fi - - if [ "$CHAINCODE_LANG" = "node" ]; then - NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") - RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") - - if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then - echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" - echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" - fi - - echo "Buiding chaincode '$CHAINCODE_NAME'..." - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" - inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - - # Default to using npm for installation and build - (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi -} - -chaincodePackage() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodeInstall() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CA_CERT=$5 - - echo "Installing chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA_CERT: $CA_CERT" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") - fi - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - -chaincodeApprove() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COLLECTIONS_CONFIG=\${10} - - echo "Approving chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYINSTALLED_RESPONSE - local CC_PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" - CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" - fi - inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --package-id "$CC_PACKAGE_ID" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeCommit() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COMMIT_PEER_ADDRESSES=\${10} - local TLS_ROOT_CERT_FILES=\${11} - local COLLECTIONS_CONFIG=\${12} - - echo "Committing chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" - inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local COMMIT_PEER_PARAMS=() - if [ -n "$COMMIT_PEER_ADDRESSES" ]; then - # shellcheck disable=SC2207 - COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) - fi - - local TLS_ROOT_CERT_PARAMS=() - if [ -n "$TLS_ROOT_CERT_FILES" ]; then - # shellcheck disable=SC2207 - TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ - "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -peerChaincodeList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - - # Execute the command to list chaincodes - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" -} - -peerChaincodeListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - local CA_CERT=$4 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CA_CERT: $CA_CERT" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" -} - -# Function to perform chaincode invoke -peerChaincodeInvoke() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - 2>&1 -} -# Function to perform chaincode invoke for Tls -peerChaincodeInvokeTls() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - local PEER_CERTS="$7" - local CA_CERT="$8" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - inputLog "PEER_CERTS: $PEER_CERTS" - inputLog "CA_CERT: $CA_CERT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - $TLS_ROOT_CERT_FILES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" \\ - 2>&1 -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -peerChannelList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list -} - -peerChannelGetInfo() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" -} - -peerChannelFetchConfig() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlock() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local TARGET_FILE="$5" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} - -#=== TLS equivalents ========================================================= - -peerChannelListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CA_CERT=$3 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" -} - -peerChannelGetInfoTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - local CA_CERT=$4 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" -} - -peerChannelFetchConfigTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - local CA_CERT=$5 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlockTls() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local CA_CERT="$5" - local TARGET_FILE="$6" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -createChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx - peer channel join -b "\${CHANNEL_NAME}".block - - rm -rf "$DIR_NAME" -} - -createChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" - peer channel join -b "\${CHANNEL_NAME}"_newest.block - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -__getOrdererAndPeerNodes() { - echo " - orderer0.group1.orderer.example.com - peer0.org1.example.com - " -} - -__getCASQLiteNodes() { - echo " - ca.orderer.example.com - " -} - -__getCAPostgresNodes() { - echo " - db.ca.org1.example.com - " -} - -__createSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" - - if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then - echo "Error: Directory '$backup_dir' already exists and is not empty!" - exit 1 - fi - - mkdir -p "$backup_dir" - cp -R ./fablo-target "$backup_dir/" - - for node in $(__getCASQLiteNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node" - docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" - done - - for node in $(__getCAPostgresNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node/pg-data" - docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Saving state of $node..." - docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" - done -} - -__cloneSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - target_dir="$1" - hook_cmd="$2" - - if [ -d "$target_dir/fablo-target" ]; then - echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." - exit 1 - fi - - cp -R ./fablo-target "$target_dir/fablo-target" - - if [ -n "$hook_cmd" ]; then - echo "Executing pre-restore hook: '$hook_cmd'" - (cd "$target_dir" && eval "$hook_cmd") - fi - - (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) - - for node in $(__getCASQLiteNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" - fi - done - - for node in $(__getCAPostgresNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" - fi - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/" "$node:/var/hyperledger/production/" - fi - done -} - -createSnapshot() { - (set -eu && __createSnapshot "$1") -} - -cloneSnapshot() { - (set -eu && __cloneSnapshot "$1" "$2") -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -# The code from this file was called after Fablo generated Hyperledger Fabric configuration -echo "Executing post-generate hook" - -perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -[ - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", -] -`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index cd90c2ebd..989a10de6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,8 +1651,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1677,7 +1675,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" else @@ -1707,7 +1705,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1728,7 +1726,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1755,7 +1753,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1785,33 +1783,32 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -1975,8 +1972,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2021,8 +2016,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2080,70 +2073,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - - # Create openssl config with SANs - cat > /certs/openssl.cnf << EOF -[req] -distinguished_name = req_distinguished_name -req_extensions = v3_req -prompt = no - -[req_distinguished_name] -CN = '"$CONTAINER_NAME"' - -[v3_req] -basicConstraints = CA:FALSE -keyUsage = nonRepudiation, digitalSignature, keyEncipherment -subjectAltName = @alt_names - -[alt_names] -DNS.1 = '"$CONTAINER_NAME"' -DNS.2 = localhost -IP.1 = 127.0.0.1 -EOF - - openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2414,6 +2343,7 @@ dockerPullIfMissing() { } node_version_check() { + local fabric_shim_version="$1" local nodejs_version @@ -2434,6 +2364,7 @@ node_version_check() { fi echo $nodejs_version + } chaincodeBuild() { @@ -2478,6 +2409,7 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi } @@ -2505,70 +2437,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2592,82 +2460,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2723,7 +2515,6 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" @@ -3355,6 +3146,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3381,5 +3197,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper fil "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 3128ff3e2..464c752e9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2365,8 +2365,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -2393,10 +2391,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" else @@ -2410,10 +2408,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" else @@ -2443,10 +2441,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2462,10 +2460,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2486,9 +2484,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "or-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'or-policy-chaincode' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Approving 'or-policy-chaincode' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2496,9 +2494,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "and-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'and-policy-chaincode' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Approving 'and-policy-chaincode' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2525,10 +2523,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2544,10 +2542,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2580,65 +2578,64 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2808,8 +2805,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2854,8 +2849,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2949,8 +2942,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -3008,70 +2999,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - - # Create openssl config with SANs - cat > /certs/openssl.cnf << EOF -[req] -distinguished_name = req_distinguished_name -req_extensions = v3_req -prompt = no - -[req_distinguished_name] -CN = '"$CONTAINER_NAME"' - -[v3_req] -basicConstraints = CA:FALSE -keyUsage = nonRepudiation, digitalSignature, keyEncipherment -subjectAltName = @alt_names - -[alt_names] -DNS.1 = '"$CONTAINER_NAME"' -DNS.2 = localhost -IP.1 = 127.0.0.1 -EOF - - openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -3342,6 +3269,7 @@ dockerPullIfMissing() { } node_version_check() { + local fabric_shim_version="$1" local nodejs_version @@ -3362,6 +3290,7 @@ node_version_check() { fi echo $nodejs_version + } chaincodeBuild() { @@ -3406,6 +3335,7 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi } @@ -3433,70 +3363,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3520,82 +3386,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3651,7 +3441,6 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" @@ -4285,6 +4074,39 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Org_Org2 [Org: Org2] + CA_ca_Org2[CA: ca_Org2 - sqlite] + Org2_peer0[Peer: peer0] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_or_policy_chaincode[Chaincode: or-policy-chaincode] + Chaincode_and_policy_chaincode[Chaincode: and-policy-chaincode] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 + Org_Org2 -.-> Channel_my_channel1 + Org2_peer0 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -4317,5 +4139,6 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 8cf0515ec..a5855968c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3467,8 +3467,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3510,10 +3508,10 @@ installChaincodes() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" else @@ -3526,10 +3524,10 @@ installChaincodes() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" else @@ -3558,10 +3556,10 @@ installChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3576,10 +3574,10 @@ installChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3600,9 +3598,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" printHeadline "Approving 'chaincode1' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "" "" @@ -3610,9 +3608,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode2" ]; then local version="0.0.1" printHeadline "Approving 'chaincode2' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" printHeadline "Approving 'chaincode2' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "" "" @@ -3638,10 +3636,10 @@ upgradeChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3656,10 +3654,10 @@ upgradeChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3704,49 +3702,48 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-chaincode2*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org2.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org2.example.com-chaincode2*" -q); do + for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -4139,8 +4136,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4190,8 +4185,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4301,8 +4294,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4352,8 +4343,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4411,70 +4400,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - - # Create openssl config with SANs - cat > /certs/openssl.cnf << EOF -[req] -distinguished_name = req_distinguished_name -req_extensions = v3_req -prompt = no - -[req_distinguished_name] -CN = '"$CONTAINER_NAME"' - -[v3_req] -basicConstraints = CA:FALSE -keyUsage = nonRepudiation, digitalSignature, keyEncipherment -subjectAltName = @alt_names - -[alt_names] -DNS.1 = '"$CONTAINER_NAME"' -DNS.2 = localhost -IP.1 = 127.0.0.1 -EOF - - openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -4745,6 +4670,7 @@ dockerPullIfMissing() { } node_version_check() { + local fabric_shim_version="$1" local nodejs_version @@ -4765,6 +4691,7 @@ node_version_check() { fi echo $nodejs_version + } chaincodeBuild() { @@ -4809,6 +4736,7 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi } @@ -4836,70 +4764,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4923,82 +4787,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5054,7 +4842,6 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" @@ -5695,6 +5482,68 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; +exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` +"graph TD + + subgraph Org_Orderer1 [Org: Orderer1] + CA_ca_Orderer1[CA: ca_Orderer1 - sqlite] + end + + subgraph Org_Orderer2 [Org: Orderer2] + CA_ca_Orderer2[CA: ca_Orderer2 - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Org_Org2 [Org: Org2] + CA_ca_Org2[CA: ca_Org2 - sqlite] + Org2_peer0[Peer: peer0] + Org2_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + subgraph Channel_my_channel2 [Channel: my-channel2] + Chaincode_chaincode2[Chaincode: chaincode2] + end + + subgraph Channel_my_channel3 [Channel: my-channel3] + end + + %% Connections + Org_Orderer1 --> Channel_my_channel1 + Org_Orderer1 --> Channel_my_channel2 + Org_Orderer1 --> Channel_my_channel3 + Org_Orderer2 --> Channel_my_channel1 + Org_Orderer2 --> Channel_my_channel2 + Org_Orderer2 --> Channel_my_channel3 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 + Org_Org2 -.-> Channel_my_channel1 + Org2_peer0 --> Channel_my_channel1 + Org2_peer1 --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel2 + Org1_peer0 --> Channel_my_channel2 + Org1_peer1 --> Channel_my_channel2 + Org_Org2 -.-> Channel_my_channel2 + Org2_peer0 --> Channel_my_channel2 + Org2_peer1 --> Channel_my_channel2 + Org_Org1 -.-> Channel_my_channel3 + Org1_peer0 --> Channel_my_channel3 + Org1_peer1 --> Channel_my_channel3 + Org_Org2 -.-> Channel_my_channel3 + Org2_peer0 --> Channel_my_channel3 + Org2_peer1 --> Channel_my_channel3 +" +`; + exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -5729,5 +5578,6 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 3b969904c..85ff1963e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3801,8 +3801,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3845,7 +3843,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -3875,7 +3873,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3896,7 +3894,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -3923,7 +3921,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3962,33 +3960,32 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -4306,8 +4303,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4355,8 +4350,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4539,8 +4532,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4588,8 +4579,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4772,8 +4761,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4821,8 +4808,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4923,70 +4908,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - - # Create openssl config with SANs - cat > /certs/openssl.cnf << EOF -[req] -distinguished_name = req_distinguished_name -req_extensions = v3_req -prompt = no - -[req_distinguished_name] -CN = '"$CONTAINER_NAME"' - -[v3_req] -basicConstraints = CA:FALSE -keyUsage = nonRepudiation, digitalSignature, keyEncipherment -subjectAltName = @alt_names - -[alt_names] -DNS.1 = '"$CONTAINER_NAME"' -DNS.2 = localhost -IP.1 = 127.0.0.1 -EOF - - openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -5257,6 +5178,7 @@ dockerPullIfMissing() { } node_version_check() { + local fabric_shim_version="$1" local nodejs_version @@ -5277,6 +5199,7 @@ node_version_check() { fi echo $nodejs_version + } chaincodeBuild() { @@ -5321,6 +5244,7 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi } @@ -5348,70 +5272,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5435,82 +5295,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5566,7 +5350,6 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" @@ -6211,6 +5994,60 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Org_Org2 [Org: Org2] + CA_ca_Org2[CA: ca_Org2 - sqlite] + Org2_peer0[Peer: peer0] + Org2_peer1[Peer: peer1] + end + + subgraph Org_Org3 [Org: Org3] + CA_ca_Org3[CA: ca_Org3 - sqlite] + Org3_peer0[Peer: peer0] + Org3_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + subgraph Channel_my_channel2 [Channel: my-channel2] + end + + subgraph Channel_my_channel3 [Channel: my-channel3] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Orderer --> Channel_my_channel2 + Org_Orderer --> Channel_my_channel3 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 + Org_Org2 -.-> Channel_my_channel2 + Org2_peer0 --> Channel_my_channel2 + Org2_peer1 --> Channel_my_channel2 + Org_Org1 -.-> Channel_my_channel3 + Org1_peer0 --> Channel_my_channel3 + Org1_peer1 --> Channel_my_channel3 + Org_Org2 -.-> Channel_my_channel3 + Org2_peer0 --> Channel_my_channel3 + Org2_peer1 --> Channel_my_channel3 +" +`; + exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -6249,5 +6086,6 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 14261a8a1..da334dbdb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1731,8 +1731,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1762,9 +1760,9 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1792,9 +1790,9 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1828,9 +1826,9 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1851,33 +1849,32 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2211,8 +2208,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2262,8 +2257,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2321,47 +2314,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2638,6 +2590,7 @@ dockerPullIfMissing() { } node_version_check() { + local fabric_shim_version="$1" local nodejs_version @@ -2658,6 +2611,7 @@ node_version_check() { fi echo $nodejs_version + } chaincodeBuild() { @@ -2702,6 +2656,7 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi } @@ -2729,70 +2684,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2816,82 +2707,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2947,7 +2762,6 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" @@ -3582,6 +3396,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3608,5 +3447,6 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper fi "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 45c40bd14..b17714cd7 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1756,8 +1756,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1786,9 +1784,9 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1816,9 +1814,9 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1852,9 +1850,9 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1875,33 +1873,32 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2235,8 +2232,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2286,8 +2281,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2345,47 +2338,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2662,6 +2614,7 @@ dockerPullIfMissing() { } node_version_check() { + local fabric_shim_version="$1" local nodejs_version @@ -2682,6 +2635,7 @@ node_version_check() { fi echo $nodejs_version + } chaincodeBuild() { @@ -2726,6 +2680,7 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi } @@ -2753,70 +2708,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local CONTAINER_PORT=$6 - local CONTAINER_NAME=$7 - local TLS_ENABLED=$8 - - echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - # Use the same container name logic as startCCaaSContainer - local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates - local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') - - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED, - \\"client_auth_required\\": true, - \\"client_cert\\": \\"$SERVER_CERT\\", - \\"client_key\\": \\"$SERVER_KEY\\", - \\"root_cert\\": \\"$ROOT_CERT\\" - }" >"$PACKAGE_DIR/code/connection.json" - else - echo "{ - \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", - \\"dial_timeout\\": \\"10s\\", - \\"tls_required\\": $TLS_ENABLED - }" >"$PACKAGE_DIR/code/connection.json" - fi - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2840,82 +2731,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CHAINCODE_IMAGE="$4" - local EXTERNAL_PORT="$5" - local CLI_NAME="$6" - local CA_CERT="$7" - - local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" - - # Query installed chaincodes to get the package ID - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local QUERYINSTALLED_RESPONSE - local PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - - if [ -z "$PACKAGE_ID" ]; then - echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" - exit 1 - fi - - echo "PACKAGE_ID: $PACKAGE_ID" - - local PACKAGE_HASH="\${PACKAGE_ID#*:}" - - echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - # Extract peer name and organization domain from peer address - local PEER_NAME="\${PEER_ADDRESS%%:*}" - - local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') - local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="\${EXTERNAL_PORT}:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - # Generate CCAAS-specific certificates with correct CN - echo "Generating CCAAS certificates for $CONTAINER_NAME..." - certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" - - # Use generated CCAAS certificates - local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2971,7 +2786,6 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then - echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" @@ -3606,6 +3420,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3632,5 +3471,6 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 2021de2b9..d6f843437 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,9 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Validation errors count: 0 -Validation warnings count: 0 -=========================================================== { "global": { "fabricVersion": "2.4.3", @@ -2012,7 +2009,6 @@ Validation warnings count: 0 } } }, - "peerChaincodeInstances": [], "privateData": [] }, { @@ -2459,7 +2455,6 @@ Validation warnings count: 0 } } }, - "peerChaincodeInstances": [], "privateData": [] } ], @@ -2474,20 +2469,12 @@ Validation warnings count: 0 exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 -Validation warnings count: 1 -=========================================================== -Validation errors count: 0 -Validation warnings count: 1 -=========================================================== -=================== Validation summary ==================== -Warnings found: - Orderer: - - Orderer consesus type is set to 'raft', but number of instances is 1. Network won't be fault tolerant! Consider higher value. +Validation warnings count: 0 =========================================================== { "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker", "fabricToolsVersion": "2.5.12", @@ -2516,7 +2503,7 @@ Warnings found: "ordererGroups": [ { "name": "group1", - "consensus": "etcdraft", + "consensus": "solo", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2530,7 +2517,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2543,7 +2530,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2555,7 +2542,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2569,7 +2556,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2601,7 +2588,7 @@ Warnings found: "ordererGroups": [ { "name": "group1", - "consensus": "etcdraft", + "consensus": "solo", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2615,7 +2602,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2628,7 +2615,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2821,7 +2808,7 @@ Warnings found: ], "ordererGroup": { "name": "group1", - "consensus": "etcdraft", + "consensus": "solo", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2835,7 +2822,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2848,7 +2835,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2860,7 +2847,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2872,7 +2859,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2981,7 +2968,7 @@ exports[`init should init simple fablo config 1`] = ` "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker" }, @@ -2999,7 +2986,7 @@ exports[`init should init simple fablo config 1`] = ` "orderers": [ { "groupName": "group1", - "type": "raft", + "type": "solo", "instances": 1, "prefix": "orderer" } @@ -3049,7 +3036,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker" }, @@ -3067,7 +3054,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "orderers": [ { "groupName": "group1", - "type": "raft", + "type": "solo", "instances": 1, "prefix": "orderer" } @@ -3111,9 +3098,9 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas", + "lang": "node", "channel": "my-channel1", - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "directory": "./chaincodes/chaincode-kv-node", "privateData": [] } ], @@ -3126,7 +3113,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker" }, @@ -3144,7 +3131,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "orderers": [ { "groupName": "group1", - "type": "raft", + "type": "solo", "instances": 1, "prefix": "orderer" } @@ -3192,9 +3179,9 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas", + "lang": "node", "channel": "my-channel1", - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "directory": "./chaincodes/chaincode-kv-node", "privateData": [] } ], diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index e3e207ebf..71ac171e2 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -28,8 +28,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -243,7 +241,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } From 29e1db57d1350395215d35ec1dc3c2420e2d361a Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 9 Sep 2024 19:34:28 +0200 Subject: [PATCH 225/471] Download custom chaincode containers for ARM only when Fabric version is lower than 2.5 Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...onfig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 4 +++- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 4 +++- ...nfig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 4 +++- ...fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 4 +++- ...nfig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 4 +++- .../templates/fabric-docker/scripts/chaincode-functions-v2.sh | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 91103b2e8..e61f8f44b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2486,7 +2486,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index cb5ac25db..285db2bdc 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2350,7 +2350,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5b4bfb004..ac9973f3a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3276,7 +3276,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 5cb507bf5..283f90b12 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4683,7 +4683,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 2bcb9006a..b1db86d3b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5190,7 +5190,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 168ddc015..d89afe8e8 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -19,7 +19,9 @@ chaincodeBuild() { # pull required images upfront in case of arm64 (Apple Silicon) architecture # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - if [ "$(uname -m)" = "arm64" ]; then + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use `sort -V` to compare versions, because `sort` handles versions like `2.4` and `2.10` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then if [ "$CHAINCODE_LANG" = "node" ]; then dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" fi From 12dd8cc9b3b865cdf241220ff9a234bdaf9e7ea9 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 10 Sep 2024 10:49:14 +0200 Subject: [PATCH 226/471] Update upload-artifacts version in CI Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .github/workflows/test-on-push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index d2ca3c8c7..f6eda5a0b 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -23,7 +23,7 @@ jobs: - name: Test simple network run: e2e-network/docker/test-01-simple.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-main @@ -112,7 +112,7 @@ jobs: - name: Test RAFT network run: e2e-network/docker/test-02-raft-2orgs.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-02-raft @@ -137,7 +137,7 @@ jobs: - name: Test private data run: e2e-network/docker/test-03-private-data.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-03-private-data @@ -162,7 +162,7 @@ jobs: - name: Test snapshots run: e2e-network/docker/test-04-snapshot.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: test-04-snapshot From 8f2f0bc6357d81b1b3a147f3f7c237edea03c59f Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 10 Sep 2024 12:19:05 +0200 Subject: [PATCH 227/471] Set version 2.0.0 Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- README.md | 8 ++++---- docs/sample.json | 2 +- docs/schema.json | 2 +- ...ablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap | 2 +- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 +++--- e2e/__snapshots__/schema.test.ts.snap | 2 +- fablo.sh | 2 +- package-lock.json | 4 ++-- package.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-k8s.json | 2 +- .../fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode.json | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml | 2 +- samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml | 2 +- .../fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json | 2 +- 20 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index d86d2c8ed..99cb8fc55 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ You may keep the script in the root directory of your project or install it glob To install it globally: ```bash -sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo +sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo ``` To get a copy of Fablo for a single project, execute in the project root: ```bash -curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/fablo.sh -o ./fablo && chmod +x ./fablo +curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o ./fablo && chmod +x ./fablo ``` ## Getting started @@ -344,7 +344,7 @@ The basic structure of Fablo config file is as follows: ```json { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { ... }, "orgs": [ ... ], "channels": [ ... ], @@ -507,7 +507,7 @@ Genrated Hooks are saved in `fablo-target/hooks`. ```yaml --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json global: fabricVersion: 2.4.2 tls: false diff --git a/docs/sample.json b/docs/sample.json index 4f31cb0f5..360bec3d8 100644 --- a/docs/sample.json +++ b/docs/sample.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": false, diff --git a/docs/schema.json b/docs/schema.json index a493429c7..fd5981002 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -12,7 +12,7 @@ ], "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json" + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json" }, "global": { "$id": "#/properties/global", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 06005696b..94939945c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -86,7 +86,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper REPOSITORY="https://kfsoftware.github.io/hlf-helm-charts" STORAGE_CLASS=$(kubectl describe sc | grep Name | tr -s ' ' | cut -d ':' -f 2 | cut -d ' ' -f 2) -FABLO_VERSION=1.2.1-unstable.0 +FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_CONFIG= ORDERER_IMAGE=hyperledger/fabric-orderer diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e61f8f44b..99c2362a8 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1524,7 +1524,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 285db2bdc..1271012f1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1434,7 +1434,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index ac9973f3a..3b5fff10f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2095,7 +2095,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 283f90b12..a509860ff 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3018,7 +3018,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index b1db86d3b..64a226525 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3314,7 +3314,7 @@ fi `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=1.2.1-unstable.0 +"FABLO_VERSION=2.0.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.0 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index f8acf3d68..10cdeed92 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2909,7 +2909,7 @@ Validation warnings count: 0 exports[`init should init simple fablo config 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -2963,7 +2963,7 @@ exports[`init should init simple fablo config 1`] = ` exports[`init should init simple fablo config with node chaincode 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3025,7 +3025,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` exports[`init should init simple fablo config with node chaincode and rest api 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index a20968227..6923640c9 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -7,7 +7,7 @@ exports[`schema should match snapshot 1`] = ` "default": {}, "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", }, "chaincodes": { "$id": "#/properties/chaincodes", diff --git a/fablo.sh b/fablo.sh index 83e55161a..ffcbc3cc7 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,7 +2,7 @@ set -e -FABLO_VERSION=1.2.1-unstable.0 +FABLO_VERSION=2.0.0 FABLO_IMAGE_NAME="softwaremill/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" diff --git a/package-lock.json b/package-lock.json index 41a98db15..dcfd87437 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generator-fablo", - "version": "1.2.1-unstable.0", + "version": "2.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "generator-fablo", - "version": "1.2.1-unstable.0", + "version": "2.0.0", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index 1fd582809..0127a6032 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-fablo", - "version": "1.2.1-unstable.0", + "version": "2.0.0", "description": "Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.", "author": "Piotr Hejwowski , Jakub Dzikowski ", "repository": { diff --git a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json index 047984810..62ef917d6 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.4.7", "tls": false, diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 8c0886b4e..176cb5a0f 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.3.3", "tls": true, diff --git a/samples/fablo-config-hlf2-1org-1chaincode.json b/samples/fablo-config-hlf2-1org-1chaincode.json index 2188ecbd8..4053ad5a0 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml index 65e6ec0e8..c71fef021 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json global: fabricVersion: 2.4.7 tls: false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml index c150b9d6d..2fdb0d9cb 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json global: fabricVersion: 2.4.3 tls: true diff --git a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json index 42b60d1c0..e1686dbfe 100644 --- a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": true, From ff9fbdcb6db69db38c969ee01e40c922772ee76b Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 10 Sep 2024 12:24:42 +0200 Subject: [PATCH 228/471] Update changelog with version 2.0.0 changes Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba0850fa..c054daef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,64 @@ -## 1.2.0-unstable +## 2.0.0 + +### Breaking changes +* Drop support for capabilities v1, and Fabric versions below 2.0.0 + [#461](https://github.com/hyperledger-labs/fablo/pull/461) + [#462](https://github.com/hyperledger-labs/fablo/pull/462) + [#464](https://github.com/hyperledger-labs/fablo/pull/464) + [#473](https://github.com/hyperledger-labs/fablo/pull/473) + [#486](https://github.com/hyperledger-labs/fablo/pull/486) + [#488](https://github.com/hyperledger-labs/fablo/pull/488) +* Drop yarn and nvm installation support + [#455](https://github.com/hyperledger-labs/fablo/pull/455) ### Features +* Add application capability V_2_5 [#463] + [#463](https://github.com/hyperledger-labs/fablo/pull/463) * Support for `chaincode invoke` command (tls and non-tls) + [#403](https://github.com/hyperledger-labs/fablo/pull/403) +* [#413](https://github.com/hyperledger-labs/fablo/pull/413) * Support for `chaincodes list` command (tls and non-tls) + [#409](https://github.com/hyperledger-labs/fablo/pull/409) + [#411](https://github.com/hyperledger-labs/fablo/pull/411) +* Christmas easter egg + [#427](https://github.com/hyperledger-labs/fablo/pull/427) +* Remove dev dependencies on chaincode installation for Node.js + [#450](https://github.com/hyperledger-labs/fablo/pull/450) +* Update Fabric version in the initial configuration + [#470]( https://github.com/hyperledger-labs/fablo/pull/470) +* Publish Fablo Docker image for ARM architecture + [#478](https://github.com/hyperledger-labs/fablo/pull/478) + [#487](https://github.com/hyperledger-labs/fablo/pull/487) ### Fixes -* Remove unsupported test library and dependencies +* Fixed https request when tls is enabled + [#438](https://github.com/hyperledger-labs/fablo/pull/438) +* Fixed issue with `fablo up` command when using CouchDB + [#443](https://github.com/hyperledger-labs/fablo/pull/443) +* Update Docker Compose command + [#465](https://github.com/hyperledger-labs/fablo/pull/465) +* Fixed issue with private data collection + [#460]( https://github.com/hyperledger-labs/fablo/pull/467) * Updated Node.js version from 12 to 16 in chaincode +* Remove unsupported test library and dependencies + +### Chore & Maintenance +* Add contributing guidelines + [#439](https://github.com/hyperledger-labs/fablo/pull/439) +* Documented the Fablo architecture in `ARCHITECTURE.md` file + [#456](https://github.com/hyperledger-labs/fablo/pull/456) +* Changed recommended Node.js version check + [#442](https://github.com/hyperledger-labs/fablo/pull/442) +* Library updates (mostly by Dependabot) +* Various CI improvements and fixes + [#467](https://github.com/hyperledger-labs/fablo/pull/467) + [#458](https://github.com/hyperledger-labs/fablo/pull/458) + [#489](https://github.com/hyperledger-labs/fablo/pull/489) +* Improve .gitignore file + [#476]( https://github.com/hyperledger-labs/fablo/pull/476) ## 1.2.0 + ### Features * Initial Kubernetes support [#351](https://github.com/hyperledger-labs/fablo/issues/351) (not yet so elastic like Fablo in terms of network topology, but ready for first views and comments) From 029148aa03b2e122ff90e4beaca2265cfd7dd439 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 10 Apr 2024 14:14:54 +0530 Subject: [PATCH 229/471] created a seperate function for node_version check, also covered all the versions for fabric shim Signed-off-by: Sanket added the snapshots Signed-off-by: Sanket suggest recommended node Signed-off-by: Sanket reafactored the code to avoid the breaking due to import of v1.4 added the snapshots fixed the function, now it is returning the proper required version Signed-off-by: Sanket Teli Update src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> changes the directory location Signed-off-by: Sanket Teli added snapshots Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- ...1chaincode-raft-explorer.json.test.ts.snap | 56 +++- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 31 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 31 +- ...1chaincode-raft-explorer.json.test.ts.snap | 31 +- package-lock.json | 277 +++++++++++++++++- package.json | 1 + .../scripts/chaincode-functions-v2.sh | 48 ++- 7 files changed, 445 insertions(+), 30 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 99c2362a8..b6f981108 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2470,12 +2470,37 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 @@ -2500,15 +2525,26 @@ chaincodeBuild() { fi fi - if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ \\"$CHAINCODE_LANG\\" = \\"node\\" ]; then + if [ \\"$(command -v nvm)\\" != \\"nvm\\" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ \\"$(command -v nvm)\\" == \\"nvm\\" ]; then + current_dir=\\"$(pwd)\\" + cd \\"$CHAINCODE_DIR_PATH\\" + set +u + nvm install + set -u + cd \\"$current_dir\\" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies.\\"fabric-shim\\"' \\"$CHAINCODE_DIR_PATH/package.json\\") + RECOMMENDED_NODE_VERSION=$(node_version_check \\"$fabric_shim_version\\") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 1271012f1..ed4c95b8e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2334,12 +2334,37 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index a509860ff..0de792cbf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4667,12 +4667,37 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 64a226525..09d70c092 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5174,12 +5174,37 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" + local IMAGE=\\"$1\\" + if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then + docker pull --platform linux/x86_64 \\"$IMAGE\\" fi } +node_version_check() { + + local fabric_shim_version=\\"$1\\" + local nodejs_version + + if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + nodejs_version=8.9 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + nodejs_version=12.13 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + nodejs_version=16.16 + + elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 diff --git a/package-lock.json b/package-lock.json index dcfd87437..40468d8b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "js-yaml": "^4.1.0", "jsonschema": "^1.2.6", "lodash": "^4.17.21", + "winston": "^2.4.7", "yeoman-generator": "^5.10.0" }, "devDependencies": { @@ -3999,8 +4000,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==", - "devOptional": true, - "peer": true, "engines": { "node": ">=0.1.90" } @@ -4158,6 +4157,41 @@ "node": ">= 8" } }, +<<<<<<< HEAD +======= + "node_modules/cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", + "dev": true + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==", + "engines": { + "node": ">=0.4.0" + } + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -5636,6 +5670,69 @@ "node": ">=4" } }, +<<<<<<< HEAD +======= + "node_modules/extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "dependencies": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -7009,6 +7106,23 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, +<<<<<<< HEAD +======= + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -11576,6 +11690,14 @@ "node": ">= 8" } }, + "node_modules/stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==", + "engines": { + "node": "*" + } + }, "node_modules/stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -13001,6 +13123,30 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "node_modules/winston": { + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.7.tgz", + "integrity": "sha512-vLB4BqzCKDnnZH9PHGoS2ycawueX4HLqENXQitvFHczhgW2vFpSOn31LZtVr1KU8YTw7DS4tM+cqyovxo8taVg==", + "dependencies": { + "async": "^2.6.4", + "colors": "1.0.x", + "cycle": "1.0.x", + "eyes": "0.1.x", + "isstream": "0.1.x", + "stack-trace": "0.0.x" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/winston/node_modules/async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "dependencies": { + "lodash": "^4.17.14" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -17453,9 +17599,7 @@ "colors": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", - "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==", - "devOptional": true, - "peer": true + "integrity": "sha512-pFGrxThWcWQ2MsAz6RtgeWe4NK2kUE1WfsrvvlctdII745EW9I0yflqhe7++M5LEc7bV2c/9/5zc8sFcpL0Drw==" }, "combined-stream": { "version": "1.0.8", @@ -17580,6 +17724,37 @@ "which": "^2.0.1" } }, +<<<<<<< HEAD +======= + "cssom": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", + "dev": true + }, + "cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "requires": { + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + } + } + }, + "cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -18697,6 +18872,56 @@ "tmp": "^0.0.33" } }, +<<<<<<< HEAD +======= + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + } + } + }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -19716,6 +19941,20 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, +<<<<<<< HEAD +======= + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" + }, +>>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -23169,6 +23408,11 @@ "minipass": "^3.1.1" } }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==" + }, "stack-utils": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", @@ -24245,6 +24489,29 @@ "string-width": "^1.0.2 || 2 || 3 || 4" } }, + "winston": { + "version": "2.4.7", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.7.tgz", + "integrity": "sha512-vLB4BqzCKDnnZH9PHGoS2ycawueX4HLqENXQitvFHczhgW2vFpSOn31LZtVr1KU8YTw7DS4tM+cqyovxo8taVg==", + "requires": { + "async": "^2.6.4", + "colors": "1.0.x", + "cycle": "1.0.x", + "eyes": "0.1.x", + "isstream": "0.1.x", + "stack-trace": "0.0.x" + }, + "dependencies": { + "async": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz", + "integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==", + "requires": { + "lodash": "^4.17.14" + } + } + } + }, "word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", diff --git a/package.json b/package.json index 0127a6032..b3f81f51d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "js-yaml": "^4.1.0", "jsonschema": "^1.2.6", "lodash": "^4.17.21", + "winston": "^2.4.7", "yeoman-generator": "^5.10.0" }, "devDependencies": { diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index d89afe8e8..e2cf6d791 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -9,6 +9,31 @@ dockerPullIfMissing() { fi } +node_version_check(){ + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 @@ -34,14 +59,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: `source ~/.nvm/nvm.sh || true` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" From ce4635508f5cd03f11014fa7c2c39952aec0140e Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 10 Sep 2024 16:33:20 +0530 Subject: [PATCH 230/471] updated snapshots Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- ...1chaincode-raft-explorer.json.test.ts.snap | 32 ++-- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 39 ++-- ...2chaincodes-private-data.yaml.test.ts.snap | 48 ++++- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 39 ++-- ...1chaincode-raft-explorer.json.test.ts.snap | 39 ++-- package-lock.json | 174 ------------------ 6 files changed, 133 insertions(+), 238 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b6f981108..62b6b7fe5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2470,27 +2470,27 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -2525,25 +2525,25 @@ chaincodeBuild() { fi fi - if [ \\"$CHAINCODE_LANG\\" = \\"node\\" ]; then - if [ \\"$(command -v nvm)\\" != \\"nvm\\" ] && [ -f ~/.nvm/nvm.sh ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) set +e source ~/.nvm/nvm.sh set -e - if [ \\"$(command -v nvm)\\" == \\"nvm\\" ]; then - current_dir=\\"$(pwd)\\" - cd \\"$CHAINCODE_DIR_PATH\\" + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" set +u nvm install set -u - cd \\"$current_dir\\" + cd "$current_dir" fi fi NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies.\\"fabric-shim\\"' \\"$CHAINCODE_DIR_PATH/package.json\\") - RECOMMENDED_NODE_VERSION=$(node_version_check \\"$fabric_shim_version\\") + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ed4c95b8e..0677a9c33 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2334,27 +2334,27 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -2390,14 +2390,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 3b5fff10f..412d243c5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3266,6 +3266,31 @@ dockerPullIfMissing() { fi } +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + chaincodeBuild() { local CHAINCODE_NAME=$1 local CHAINCODE_LANG=$2 @@ -3291,14 +3316,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 0de792cbf..19503c67c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4667,27 +4667,27 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -4723,14 +4723,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 09d70c092..a7c7b27cf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5174,27 +5174,27 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr # see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u dockerPullIfMissing() { - local IMAGE=\\"$1\\" - if [[ \\"$(docker images -q \\"$IMAGE\\" 2>/dev/null)\\" == \\"\\" ]]; then - docker pull --platform linux/x86_64 \\"$IMAGE\\" + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" fi } node_version_check() { - local fabric_shim_version=\\"$1\\" + local fabric_shim_version="$1" local nodejs_version - if [[ \\"$fabric_shim_version\\" == *\\"1.4.\\"* ]]; then + if [[ "$fabric_shim_version" == *"1.4."* ]]; then nodejs_version=8.9 - elif [[ \\"$fabric_shim_version\\" == *\\"2.2.\\"* || \\"$fabric_shim_version\\" == *\\"2.3.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then nodejs_version=12.13 - elif [[ \\"$fabric_shim_version\\" == *\\"2.4.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then nodejs_version=16.16 - elif [[ \\"$fabric_shim_version\\" == *\\"2.5.\\"* ]]; then + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then nodejs_version=18.12 else @@ -5230,14 +5230,25 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - - NODE_VERSION="$(node --version)" - - USES_OLD_FABRIC_SHIM="$(jq '.dependencies."fabric-shim" | contains("1.4.")' "$CHAINCODE_DIR_PATH/package.json")" - if [ "$USES_OLD_FABRIC_SHIM" == "true" ]; then - RECOMMENDED_NODE_VERSION="8.9" + if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then + # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) + set +e + source ~/.nvm/nvm.sh + set -e + if [ "$(command -v nvm)" == "nvm" ]; then + current_dir="$(pwd)" + cd "$CHAINCODE_DIR_PATH" + set +u + nvm install + set -u + cd "$current_dir" + fi fi + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" diff --git a/package-lock.json b/package-lock.json index 40468d8b3..8ec5e9e25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4157,32 +4157,6 @@ "node": ">= 8" } }, -<<<<<<< HEAD -======= - "node_modules/cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "dependencies": { - "cssom": "~0.3.6" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - }, "node_modules/cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", @@ -4191,7 +4165,6 @@ "node": ">=0.4.0" } }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -5670,60 +5643,6 @@ "node": ">=4" } }, -<<<<<<< HEAD -======= - "node_modules/extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "dependencies": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", @@ -5732,7 +5651,6 @@ "node": "> 0.1.90" } }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -7106,23 +7024,11 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, -<<<<<<< HEAD -======= - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -17724,37 +17630,11 @@ "which": "^2.0.1" } }, -<<<<<<< HEAD -======= - "cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - } - } - }, "cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "damerau-levenshtein": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", @@ -18872,56 +18752,11 @@ "tmp": "^0.0.33" } }, -<<<<<<< HEAD -======= - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - } - } - }, "eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -19941,20 +19776,11 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" }, -<<<<<<< HEAD -======= - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" }, ->>>>>>> 2ce9502 (created a seperate function for node_version check, also covered all the versions for fabric shim) "istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", From 8eb427a7c1e90359ce3e183191634c407ee781c1 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 10 Sep 2024 17:06:42 +0530 Subject: [PATCH 231/471] updated Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- ...org-1chaincode-raft-explorer.json.test.ts.snap | 15 --------------- ...-config-hlf2-1org-1chaincode.json.test.ts.snap | 15 --------------- ...rgs-2chaincodes-private-data.yaml.test.ts.snap | 15 --------------- ...-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 15 --------------- ...rgs-1chaincode-raft-explorer.json.test.ts.snap | 15 --------------- .../scripts/chaincode-functions-v2.sh | 15 --------------- 6 files changed, 90 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 62b6b7fe5..8ba0285b2 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2526,21 +2526,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 0677a9c33..c9d881ec6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2390,21 +2390,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 412d243c5..fc5b44dd3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3316,21 +3316,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 19503c67c..26ad2be93 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4723,21 +4723,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index a7c7b27cf..a79e2338d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5230,21 +5230,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: \`source ~/.nvm/nvm.sh || true\` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index e2cf6d791..f35d4c26d 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -59,21 +59,6 @@ chaincodeBuild() { fi if [ "$CHAINCODE_LANG" = "node" ]; then - if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then - # note: `source ~/.nvm/nvm.sh || true` seems to not work on some shells (like /bin/zsh on Apple Silicon) - set +e - source ~/.nvm/nvm.sh - set -e - if [ "$(command -v nvm)" == "nvm" ]; then - current_dir="$(pwd)" - cd "$CHAINCODE_DIR_PATH" - set +u - nvm install - set -u - cd "$current_dir" - fi - fi - NODE_VERSION=$(node --version) fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") From e97aa6edf84c107502be721a98470bc84c11163b Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:29:43 +0200 Subject: [PATCH 232/471] Update changelog: add info about new Fablo Docker image registry Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c054daef1..5efde50d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,8 @@ [#489](https://github.com/hyperledger-labs/fablo/pull/489) * Improve .gitignore file [#476]( https://github.com/hyperledger-labs/fablo/pull/476) +* Update Fablo docker image registry to GHCR + [#491](https://github.com/hyperledger-labs/fablo/pull/491) ## 1.2.0 From 49ea6504e018f226775152e3ee962174d7ac72e7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:27:13 +0200 Subject: [PATCH 233/471] Update Fablo Docker image registry to GHCR Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .github/workflows/publish-docker-on-main.yml | 12 ++-- .github/workflows/release-on-tag.yml | 2 +- CHANGELOG.md | 2 +- README.md | 10 +-- fablo-build.sh | 6 +- fablo.sh | 4 +- samples/invalid-fablo-config.json | 67 ++++++++++++++++++++ src/repositoryUtils.ts | 2 +- 8 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 samples/invalid-fablo-config.json diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index 9854955e6..79c91d8c7 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -5,9 +5,6 @@ on: branches: - main -env: - IMAGE_NAME: softwaremill/fablo - jobs: publish-docker: runs-on: ubuntu-latest @@ -21,11 +18,12 @@ jobs: with: driver: docker-container - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Login to GHCR + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_LOGIN }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image run: | diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index bdcc5e71f..8570a4e36 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -41,7 +41,7 @@ jobs: - name: Publish Docker image run: | FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push softwaremill/fablo:"$FABLO_VERSION" + docker push ghcr.io/hyperledger-labs/fablo:"$FABLO_VERSION" - name: Create GitHub Release uses: "marvinpinto/action-automatic-releases@latest" diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efde50d2..81b56ebbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,7 +117,7 @@ ## 0.3.0 ### Features -* Add [Fablo REST](https://github.com/softwaremill/fablo-rest/) support +* Add [Fablo REST](https://github.com/fablo-io/fablo-rest/) support * By default all peers are anchor peers * Support `postGenerate` hook * Added support for [Orderer sharding](https://github.com/hyperledger-labs/fablo/issues/220) (multiple orderer groups). diff --git a/README.md b/README.md index 99cb8fc55..95ebe9799 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Fablo supports: * RAFT and solo consensus protocols * Multiple organizations and channels * Chaincode installation and upgrade -* REST API client for CA and chaincodes ([Fablo REST](https://github.com/softwaremill/fablo-rest)) +* REST API client for CA and chaincodes ([Fablo REST](https://github.com/fablo-io/fablo-rest)) * [Blockchain Explorer](https://github.com/hyperledger/blockchain-explorer) which can be enabled for each organization ## See it in action @@ -42,7 +42,7 @@ To create a local Hyperledger Fabric network with Node.js chaincode and REST API ``` After a few minutes the whole network will be set up and running. -You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/softwaremill/fablo-rest)). +You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/fablo-io/fablo-rest)). ## Basic usage @@ -78,7 +78,7 @@ Good step to start your adventure with Fablo or set up a fast prototype. Fablo `init` command takes three parameters (the order does not matter): * Option `node` makes Fablo to generate a sample Node.js chaincode as well. -* Option `rest` enables simple REST API with [Fablo REST](https://github.com/softwaremill/fablo-rest) as standalone Docker container. +* Option `rest` enables simple REST API with [Fablo REST](https://github.com/fablo-io/fablo-rest) as standalone Docker container. * Option `dev` enables running peers in dev mode (so the hot reload for chaincode is possible). Sample command: @@ -570,9 +570,9 @@ You can find them in `fablo-target/fablo-config/connection-profiles` directory i ### REST API -Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/softwaremill/fablo-rest). +Fablo is integrated with simple REST API for CA and chaincodes, supported by [Fablo REST](https://github.com/fablo-io/fablo-rest). If you want to use it, provide for your organization `"tools": { "fabloRest": true }`. -Visit the [Fablo REST](https://github.com/softwaremill/fablo-rest) project for more documentation. +Visit the [Fablo REST](https://github.com/fablo-io/fablo-rest) project for more documentation. ### Blockchain Explorer diff --git a/fablo-build.sh b/fablo-build.sh index 4ff749044..a261521a4 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -15,7 +15,7 @@ echo " FABLO_HOME: $FABLO_HOME" echo " FABLO_VERSION: $FABLO_VERSION" echo " VERSION_DETAILS: $VERSION_DETAILS" -IMAGE_BASE_NAME="softwaremill/fablo:$FABLO_VERSION" +IMAGE_BASE_NAME="ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then set +e @@ -37,7 +37,7 @@ if [ "${1:-''}" = "--push" ]; then docker buildx build \ --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --platform linux/amd64,linux/arm64 \ - --tag "softwaremill/fablo:$FABLO_VERSION" \ + --tag "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" \ --push \ "$FABLO_HOME" else @@ -45,5 +45,5 @@ else --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" - docker tag "$IMAGE_BASE_NAME" "softwaremill/fablo:$FABLO_VERSION" + docker tag "$IMAGE_BASE_NAME" "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" fi diff --git a/fablo.sh b/fablo.sh index ffcbc3cc7..cc3a43885 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,8 +2,8 @@ set -e -FABLO_VERSION=2.0.0 -FABLO_IMAGE_NAME="softwaremill/fablo" +FABLO_VERSION=1.2.1-unstable.0 +FABLO_IMAGE_NAME="ghcr.io/hyperledger-labs/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" COMMAND="$1" diff --git a/samples/invalid-fablo-config.json b/samples/invalid-fablo-config.json new file mode 100644 index 000000000..eefc9daef --- /dev/null +++ b/samples/invalid-fablo-config.json @@ -0,0 +1,67 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", + "global": { + "fabricVersion": "2.5.12", + "tls": true, + "tools": { + "explorer": true + } + }, + "orgs": [ + { + "organization": { + "name": "some-org1", + "domain": "orderer.example.com", + "mspName": "some-org1" + }, + "orderers": [ + { + "groupName": "group1", + "type": "raft", + "instances": 1 + } + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "ca": { + "db": "postgres" + }, + "peer": { + "instances": 1, + "db": "CouchDb" + }, + "tools": { + "fabloRest": true + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ], + "hooks": { + "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' \"./fablo-target/fabric-config/configtx.yaml\"" + } +} \ No newline at end of file diff --git a/src/repositoryUtils.ts b/src/repositoryUtils.ts index 03919cd83..58d61e943 100644 --- a/src/repositoryUtils.ts +++ b/src/repositoryUtils.ts @@ -1,6 +1,6 @@ import got from "got"; -const repositoryName = "softwaremill/fablo"; +const repositoryName = "ghcr.io/hyperledger-labs/fablo"; const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`; const incrementVersionFragment = (versionFragment: string) => { From 254d749c9cf6284f332ba82158d48a31e7080a15 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Thu, 12 Sep 2024 12:42:48 +0200 Subject: [PATCH 234/471] Update Fablo REST version and registry Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- src/setup-docker/index.ts | 2 +- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- src/setup-k8s/index.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 8ba0285b2..85c4f24e4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2034,7 +2034,7 @@ services: fablo-rest.org1.example.com: container_name: fablo-rest.org1.example.com - image: softwaremill/fablo-rest:\${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=Org1MSP diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 26ad2be93..3e3f8a648 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4091,7 +4091,7 @@ services: fablo-rest.org1.example.com: container_name: fablo-rest.org1.example.com - image: softwaremill/fablo-rest:\${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=Org1MSP diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 47ac08e08..092dfe784 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -161,7 +161,7 @@ export default class SetupDockerGenerator extends Generator { paths: global.paths, fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), - fabloRestVersion: "0.1.0", + fabloRestVersion: "0.1.2", hyperledgerExplorerVersion: "1.1.8", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9ac57cbb3..2ec40b3d3 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -110,7 +110,7 @@ services: <%_ if (org.tools.fabloRest) { _%> <%= org.tools.fabloRest.address %>: container_name: <%= org.tools.fabloRest.address %> - image: softwaremill/fablo-rest:${FABLO_REST_VERSION} + image: ghcr.io/fablo-io/fablo-rest:${FABLO_REST_VERSION} environment: - PORT=8000 - MSP_ID=<%= org.tools.fabloRest.mspId %> diff --git a/src/setup-k8s/index.ts b/src/setup-k8s/index.ts index 473da5943..36a99e889 100644 --- a/src/setup-k8s/index.ts +++ b/src/setup-k8s/index.ts @@ -68,7 +68,7 @@ export default class SetupDockerGenerator extends Generator { paths: global.paths, fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), - fabloRestVersion: "0.1.0", + fabloRestVersion: "0.1.2", hyperledgerExplorerVersion: "1.1.8", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", From 1c6d758f7d1f4e5c6d1b5f5af375b7338c217682 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 14:17:36 +0200 Subject: [PATCH 235/471] Update getting Fablo versions Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- src/repositoryUtils.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/repositoryUtils.ts b/src/repositoryUtils.ts index 58d61e943..d3c30be0a 100644 --- a/src/repositoryUtils.ts +++ b/src/repositoryUtils.ts @@ -1,7 +1,6 @@ import got from "got"; -const repositoryName = "ghcr.io/hyperledger-labs/fablo"; -const repositoryTagsListUrl = `https://registry.hub.docker.com/v2/repositories/${repositoryName}/tags`; +const repositoryTagsListUrl = `https://api.github.com/repos/hyperledger-labs/fablo/releases`; const incrementVersionFragment = (versionFragment: string) => { if (versionFragment.includes("-")) { @@ -55,21 +54,23 @@ const version = (v: string): Version => ({ }, }); -const requestVersionNames = (): Promise<{ results: { name: string }[] }> => { +const requestVersionNames = (): Promise<{ tag_name: string }[]> => { const params = { searchParams: { tag_status: "active", page_size: 1024, }, }; - return got(repositoryTagsListUrl, params).json<{ results: { name: string }[] }>(); + return got(repositoryTagsListUrl, params).json<{ tag_name: string }[]>(); }; +const versionRegex = /^v\d+\.\d+\.\d+(-[a-zA-Z0-9-]+)?$/; + const getAvailableTags = async (): Promise => { try { - const versionNames = (await requestVersionNames()).results - .filter((v) => v.name !== "latest") - .map((tag) => tag.name); + const versionNames = (await requestVersionNames()) + .filter((release) => versionRegex.test(release.tag_name)) + .map((release) => release.tag_name.slice(1)); return sortVersions(versionNames); } catch (err) { console.log(`Could not check for updates. Url: '${repositoryTagsListUrl}' not available`); From a733c3d3be07a88300597840ee9ced47e77f1a11 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 14:17:49 +0200 Subject: [PATCH 236/471] Update snapshots Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 85c4f24e4..e86497d72 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1526,7 +1526,7 @@ fi exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index c9d881ec6..b207f8f5d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1436,7 +1436,7 @@ fi exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index fc5b44dd3..33bc82dc4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2097,7 +2097,7 @@ fi exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 3e3f8a648..1f2d6803a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3020,7 +3020,7 @@ fi exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index a79e2338d..f6e7b7d26 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3316,7 +3316,7 @@ fi exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` "FABLO_VERSION=2.0.0 FABLO_BUILD= -FABLO_REST_VERSION=0.1.0 +FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 From 1f1c2c6d5f4e88cac10603f97e38892c86473f89 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 16:41:58 +0200 Subject: [PATCH 237/471] Set Docker registry to ghcr.io/fablo-io/fablo Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .github/workflows/release-on-tag.yml | 2 +- fablo-build.sh | 6 +++--- fablo.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 8570a4e36..6ada1b7d3 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -41,7 +41,7 @@ jobs: - name: Publish Docker image run: | FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push ghcr.io/hyperledger-labs/fablo:"$FABLO_VERSION" + docker push ghcr.io/fablo-io/fablo:"$FABLO_VERSION" - name: Create GitHub Release uses: "marvinpinto/action-automatic-releases@latest" diff --git a/fablo-build.sh b/fablo-build.sh index a261521a4..be08ec90d 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -15,7 +15,7 @@ echo " FABLO_HOME: $FABLO_HOME" echo " FABLO_VERSION: $FABLO_VERSION" echo " VERSION_DETAILS: $VERSION_DETAILS" -IMAGE_BASE_NAME="ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" +IMAGE_BASE_NAME="ghcr.io/fablo-io/fablo:$FABLO_VERSION" if [ "$(command -v nvm)" != "nvm" ] && [ -f ~/.nvm/nvm.sh ]; then set +e @@ -37,7 +37,7 @@ if [ "${1:-''}" = "--push" ]; then docker buildx build \ --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --platform linux/amd64,linux/arm64 \ - --tag "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" \ + --tag "ghcr.io/fablo-io/fablo:$FABLO_VERSION" \ --push \ "$FABLO_HOME" else @@ -45,5 +45,5 @@ else --build-arg VERSION_DETAILS="$VERSION_DETAILS" \ --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" - docker tag "$IMAGE_BASE_NAME" "ghcr.io/hyperledger-labs/fablo:$FABLO_VERSION" + docker tag "$IMAGE_BASE_NAME" "ghcr.io/fablo-io/fablo:$FABLO_VERSION" fi diff --git a/fablo.sh b/fablo.sh index cc3a43885..ac6dbaeaa 100755 --- a/fablo.sh +++ b/fablo.sh @@ -3,7 +3,7 @@ set -e FABLO_VERSION=1.2.1-unstable.0 -FABLO_IMAGE_NAME="ghcr.io/hyperledger-labs/fablo" +FABLO_IMAGE_NAME="ghcr.io/fablo-io/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" COMMAND="$1" From 2bac13adf61e7c9e1d111e1d7bf8b90e9fa35776 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 16:50:35 +0200 Subject: [PATCH 238/471] Update release action Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .github/workflows/release-on-tag.yml | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 6ada1b7d3..4055a0697 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -25,29 +25,28 @@ jobs: exit 1 fi - - name: Build Fablo - run: | - shellcheck --version - yamllint -v - npm install - ./fablo-build.sh + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: docker-container - - name: Login to DockerHub - uses: docker/login-action@v1 + - name: Login to GHCR + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_LOGIN }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Publish Docker image + - name: Build and push Docker image run: | - FABLO_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") - docker push ghcr.io/fablo-io/fablo:"$FABLO_VERSION" + shellcheck --version + yamllint -v + npm install + ./fablo-build.sh --push - - name: Create GitHub Release - uses: "marvinpinto/action-automatic-releases@latest" + - name: Create release + uses: softprops/action-gh-release@v2 with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false files: | docs/schema.json fablo.sh From de039b6af3254eb0792d5dc18769e4424299b5db Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 17 Sep 2024 17:14:32 +0200 Subject: [PATCH 239/471] Update GHCR credentials Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .github/workflows/publish-docker-on-main.yml | 4 ++-- .github/workflows/release-on-tag.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index 79c91d8c7..bc1438f73 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -22,8 +22,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.GHCR_USER }} + password: ${{ secrets.GHCR_TOKEN }} - name: Build and push Docker image run: | diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 4055a0697..92995e5db 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -34,8 +34,8 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.GHCR_USER }} + password: ${{ secrets.GHCR_TOKEN }} - name: Build and push Docker image run: | From 730ef7cc6cef9c24014e9767b348a11979dab69f Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 19:35:49 +0200 Subject: [PATCH 240/471] Fix errors when yeoman is printing messages Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/fabloCommands.test.ts | 32 ++++++++++++++++++++++++++++ src/app/index.ts | 6 +++--- src/extend-config/index.ts | 2 +- src/init/index.ts | 10 ++++----- src/list-compatible-updates/index.ts | 14 ++++++------ src/list-versions/index.ts | 2 +- src/setup-docker/index.ts | 12 +++++------ src/setup-k8s/index.ts | 10 ++++----- src/validate/index.ts | 20 ++++++++--------- src/version/index.ts | 4 ++-- 10 files changed, 72 insertions(+), 40 deletions(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index b010927c8..0467df2e6 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -1,5 +1,7 @@ import TestCommands from "./TestCommands"; import { version as currentFabloVersion } from "../package.json"; +import { FabloConfigJson } from "../generators/types/FabloConfigJson"; +import * as fs from "fs"; const commands = new TestCommands("e2e/__tmp__/commands-tests"); @@ -104,6 +106,36 @@ describe("validate", () => { expect(commandResult.output).toContain("commands-tests/fablo-config.json does not exist\n"); expect(commands.getFiles()).toEqual([]); }); + + it("should print validation errors", () => { + // Given + const sourceConfigPath = require.resolve("../samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json"); + const samplesDir = sourceConfigPath.replace("/fablo-config-hlf2-1org-1chaincode-raft-explorer.json", ""); + const sourceConfig = require(sourceConfigPath) as FabloConfigJson; + + // old schema + sourceConfig.$schema = "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json" + + // invalid org + sourceConfig.orgs[0].organization.mspName = "some-org1"; + sourceConfig.orgs[0].organization.name = "some-org1"; + + // save updated config + fs.writeFileSync(`${samplesDir}/invalid-fablo-config.json`, JSON.stringify(sourceConfig, null, 2)); + const fabloConfig = `${commands.relativeRoot}/samples/invalid-fablo-config.json`; + + // When + const commandResult = commands.fabloExec(`validate ${fabloConfig}`); + + // Then + expect(commandResult).toEqual(TestCommands.success()); + expect(commandResult.output).toContain("Critical error occured"); + expect(commandResult.output).toContain("Json schema validation failed!"); + expect(commandResult.output).toContain("instance.$schema : does not exactly match expected constant"); + expect(commandResult.output).toContain(" instance.orgs[0].organization.name : does not match pattern"); + expect(commandResult.output).toContain(" instance.orgs[0].organization.mspName : does not match pattern"); + expect(commands.getFiles()).toEqual([]); + }); }); describe("extend config", () => { diff --git a/src/app/index.ts b/src/app/index.ts index 7548441d3..e94ef2b05 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -3,8 +3,8 @@ import * as Generator from "yeoman-generator"; export default class extends Generator { displayInfo(): void { const url = "https://github.com/hyperledger-labs/fablo"; - this.log("This is main entry point for Yeoman app used in Fablo."); - this.log("Visit the project page to get more information."); - this.log(`---\n${url}\n---`); + console.log("This is main entry point for Yeoman app used in Fablo."); + console.log("Visit the project page to get more information."); + console.log(`---\n${url}\n---`); } } diff --git a/src/extend-config/index.ts b/src/extend-config/index.ts index ee0998947..6c9b92758 100644 --- a/src/extend-config/index.ts +++ b/src/extend-config/index.ts @@ -22,7 +22,7 @@ class ExtendConfigGenerator extends Generator { const fabloConfigPath = `${this.env.cwd}/${this.options.fabloConfig}`; const json = parseFabloConfig(this.fs.read(fabloConfigPath)); const configExtended = extendConfig(json); - this.log(JSON.stringify(configExtended, undefined, 2)); + console.log(JSON.stringify(configExtended, undefined, 2)); } } diff --git a/src/init/index.ts b/src/init/index.ts index cb550fe6b..000730544 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -13,7 +13,7 @@ export default class InitGenerator extends Generator { const shouldInitWithNodeChaincode = this.args.length && this.args.find((v) => v === "node"); if (shouldInitWithNodeChaincode) { - this.log("Creating sample Node.js chaincode"); + console.log("Creating sample Node.js chaincode"); this.fs.copy(this.templatePath("chaincodes"), this.destinationPath("chaincodes")); // force build on Node 12, since dev deps (@theledger/fabric-mock-stub) may not work on 16 this.fs.write(this.destinationPath("chaincodes/chaincode-kv-node/.nvmrc"), "12"); @@ -42,10 +42,10 @@ export default class InitGenerator extends Generator { this.fs.write(this.destinationPath("fablo-config.json"), JSON.stringify(fabloConfigJson, undefined, 2)); this.on("end", () => { - this.log("==========================================================="); - this.log(chalk.bold("Sample config file created! :)")); - this.log("You can start your network with 'fablo up' command"); - this.log("==========================================================="); + console.log("==========================================================="); + console.log(chalk.bold("Sample config file created! :)")); + console.log("You can start your network with 'fablo up' command"); + console.log("==========================================================="); }); } } diff --git a/src/list-compatible-updates/index.ts b/src/list-compatible-updates/index.ts index 2c97cfd5d..092660288 100644 --- a/src/list-compatible-updates/index.ts +++ b/src/list-compatible-updates/index.ts @@ -14,13 +14,13 @@ export default class ListCompatibleUpdatesGenerator extends Generator { _printVersions(versionsToPrint: string[]): void { if (versionsToPrint.length > 0) { - this.log(chalk.bold("====== !Compatible Fablo versions found! :) =============")); - this.log(`${chalk.underline.bold("Compatible")} versions:`); - versionsToPrint.forEach((version) => this.log(`- ${version}`)); - this.log(""); - this.log("To update just run command:"); - this.log(`\t${chalk.bold("fablo use [version]")}`); - this.log(chalk.bold("===========================================================")); + console.log(chalk.bold("====== !Compatible Fablo versions found! :) =============")); + console.log(`${chalk.underline.bold("Compatible")} versions:`); + versionsToPrint.forEach((version) => console.log(`- ${version}`)); + console.log(""); + console.log("To update just run command:"); + console.log(`\t${chalk.bold("fablo use [version]")}`); + console.log(chalk.bold("===========================================================")); } } } diff --git a/src/list-versions/index.ts b/src/list-versions/index.ts index 143d399cd..a16e7c214 100644 --- a/src/list-versions/index.ts +++ b/src/list-versions/index.ts @@ -9,6 +9,6 @@ export default class ListVersionsGenerator extends Generator { .map((v) => (v === config.fabloVersion ? `${v} <== current` : v)) .map((v) => (config.isFabloVersionSupported(v) && !v.includes("current") ? `${v} (compatible)` : v)); - versionsSortedAndMarked.forEach((version) => this.log(`- ${version}`)); + versionsSortedAndMarked.forEach((version) => console.log(`- ${version}`)); } } diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 092dfe784..560eb1e8a 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -48,9 +48,9 @@ export default class SetupDockerGenerator extends Generator { .replace(/[^0-9]+/g, ""); const composeNetworkName = `fablo_network_${dateString}`; - this.log(`Used network config: ${fabloConfigPath}`); - this.log(`Fabric version is: ${global.fabricVersion}`); - this.log(`Generating docker-compose network '${composeNetworkName}'...`); + console.log(`Used network config: ${fabloConfigPath}`); + console.log(`Fabric version is: ${global.fabricVersion}`); + console.log(`Generating docker-compose network '${composeNetworkName}'...`); // ======= fabric-config ============================================================ this._copyOrgCryptoConfig(orgs); @@ -73,9 +73,9 @@ export default class SetupDockerGenerator extends Generator { this._copyHooks(config.hooks); this.on("end", () => { - this.log("Done & done !!! Try the network out: "); - this.log("-> fablo up - to start network"); - this.log("-> fablo help - to view all commands"); + console.log("Done & done !!! Try the network out: "); + console.log("-> fablo up - to start network"); + console.log("-> fablo help - to view all commands"); }); } diff --git a/src/setup-k8s/index.ts b/src/setup-k8s/index.ts index 36a99e889..4c5a9cc87 100644 --- a/src/setup-k8s/index.ts +++ b/src/setup-k8s/index.ts @@ -32,8 +32,8 @@ export default class SetupDockerGenerator extends Generator { .replace(/[^0-9]+/g, ""); const composeNetworkName = `fablo_network_${dateString}`; - this.log(`Used network config: ${fabloConfigPath}`); - this.log(`Fabric version is: ${global.fabricVersion}`); + console.log(`Used network config: ${fabloConfigPath}`); + console.log(`Fabric version is: ${global.fabricVersion}`); this._copyGitIgnore(); @@ -49,9 +49,9 @@ export default class SetupDockerGenerator extends Generator { this._copyHooks(config.hooks); this.on("end", () => { - this.log("Done & done !!! Try the network out: "); - this.log("-> fablo up - to start network"); - this.log("-> fablo help - to view all commands"); + console.log("Done & done !!! Try the network out: "); + console.log("-> fablo up - to start network"); + console.log("-> fablo help - to view all commands"); }); } diff --git a/src/validate/index.ts b/src/validate/index.ts index d25fcf554..98c80bca0 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -74,8 +74,8 @@ class ValidateGenerator extends Generator { }); this.addListener(validationErrorType.CRITICAL, (event) => { - this.log(chalk.bold.bgRed("Critical error occured:")); - this.log(chalk.bold(`- ${event.message}`)); + console.log(chalk.bold.bgRed("Critical error occured:")); + console.log(chalk.bold(`- ${event.message}`)); this._printIfNotEmpty(this.errors.getAllMessages(), chalk.red.bold("Errors found:")); process.exit(1); }); @@ -123,19 +123,19 @@ class ValidateGenerator extends Generator { } async shortSummary() { - this.log(`Validation errors count: ${this.errors.count()}`); - this.log(`Validation warnings count: ${this.warnings.count()}`); - this.log(chalk.bold("===========================================================")); + console.log(`Validation errors count: ${this.errors.count()}`); + console.log(`Validation warnings count: ${this.warnings.count()}`); + console.log(chalk.bold("===========================================================")); } async detailedSummary() { const allValidationMessagesCount = this.errors.count() + this.warnings.count(); if (allValidationMessagesCount > 0) { - this.log(chalk.bold("=================== Validation summary ====================")); + console.log(chalk.bold("=================== Validation summary ====================")); this._printIfNotEmpty(this.errors.getAllMessages(), chalk.red.bold("Errors found:")); this._printIfNotEmpty(this.warnings.getAllMessages(), chalk.yellow("Warnings found:")); - this.log(chalk.bold("===========================================================")); + console.log(chalk.bold("===========================================================")); } if (this.errors.count() > 0) { @@ -179,13 +179,13 @@ class ValidateGenerator extends Generator { _printIfNotEmpty(messages: Message[], caption: string) { if (messages.length > 0) { - this.log(caption); + console.log(caption); const grouped: Record = _.groupBy(messages, (msg) => msg.category); Object.keys(grouped).forEach((key) => { - this.log(chalk.bold(` ${key}:`)); - grouped[key].forEach((msg) => this.log(` - ${msg.message}`)); + console.log(chalk.bold(` ${key}:`)); + grouped[key].forEach((msg) => console.log(` - ${msg.message}`)); }); } } diff --git a/src/version/index.ts b/src/version/index.ts index b3cfe7795..e5b1680e9 100644 --- a/src/version/index.ts +++ b/src/version/index.ts @@ -12,9 +12,9 @@ export default class VersionGenerator extends Generator { async printVersion(): Promise { if (typeof this.options.verbose !== "undefined") { - this.log(JSON.stringify(fullInfo(), null, 2)); + console.log(JSON.stringify(fullInfo(), null, 2)); } else { - this.log(JSON.stringify(basicInfo(), null, 2)); + console.log(JSON.stringify(basicInfo(), null, 2)); } } } From 452756167b608915556f3eb279850530a10c5e92 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 19:40:42 +0200 Subject: [PATCH 241/471] Fix import path Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/fabloCommands.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 0467df2e6..e98c375aa 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -1,6 +1,6 @@ import TestCommands from "./TestCommands"; import { version as currentFabloVersion } from "../package.json"; -import { FabloConfigJson } from "../generators/types/FabloConfigJson"; +import { FabloConfigJson } from "../src/types/FabloConfigJson"; import * as fs from "fs"; const commands = new TestCommands("e2e/__tmp__/commands-tests"); From a34c529e94612ae06fb2081946fe266bd52b8072 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 19:55:16 +0200 Subject: [PATCH 242/471] Update snapshots Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 786 ++++++++++++++++++++ 1 file changed, 786 insertions(+) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 4c88a8589..a926ccf3f 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -8926,3 +8926,789 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. ], } `; + +exports[`extend config samples/invalid-fablo-config.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": undefined, + "initRequired": false, + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_0", + "channel": "V2_0", + "isV2": true, + "isV3": false, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "2.3.3", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "2.3.3", + "fabricJavaenvVersion": "2.3", + "fabricNodeenvVersion": "2.3", + "fabricRecommendedNodeVersion": "12", + "fabricVersion": "2.3.3", + "monitoring": { + "loglevel": "info", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": { + "explorer": { + "address": "explorer.example.com", + "port": 7010, + }, + }, + }, + "hooks": { + "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "SOME-ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "SOME-ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-some-org1", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "some-org1", + "name": "some-org1", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "some-org1", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7030, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "bootstrapPeers": "peer0.org1.example.com:7041", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "postgres", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": false, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + ], + "peersCount": 1, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, + }, + ], +} +`; From 74b33ac1b2fab2a9e7207791d74dbb79a0503e54 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Oct 2024 20:09:23 +0200 Subject: [PATCH 243/471] Fix linting Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/fabloCommands.test.ts | 3 ++- src/extend-config/extendGlobal.ts | 5 ++--- src/types/FabloConfigExtended.ts | 2 -- src/validate/index.ts | 6 +++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index e98c375aa..65a893d79 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -111,10 +111,11 @@ describe("validate", () => { // Given const sourceConfigPath = require.resolve("../samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json"); const samplesDir = sourceConfigPath.replace("/fablo-config-hlf2-1org-1chaincode-raft-explorer.json", ""); + // eslint-disable-next-line @typescript-eslint/no-var-requires const sourceConfig = require(sourceConfigPath) as FabloConfigJson; // old schema - sourceConfig.$schema = "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json" + sourceConfig.$schema = "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json"; // invalid org sourceConfig.orgs[0].organization.mspName = "some-org1"; diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 86fe31fff..9cd63d378 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -5,14 +5,13 @@ import { GlobalJson } from "../types/FabloConfigJson"; import defaults from "./defaults"; const getNetworkCapabilities = (fabricVersion: string): Capabilities => { - if (version(fabricVersion).isGreaterOrEqual("2.5.0") && !version(fabricVersion).isGreaterOrEqual("3.0.0")) return { channel: "V2_0", orderer: "V2_0", application: "V2_5", isV2: true, isV3: false }; if (version(fabricVersion).isGreaterOrEqual("3.0.0")) - return { channel: "V3_0", orderer: "V2_0", application: "V2_5", isV2: false, isV3: true}; + return { channel: "V3_0", orderer: "V2_0", application: "V2_5", isV2: false, isV3: true }; - return { channel: "V2_0", orderer: "V2_0", application: "V2_0", isV2: true , isV3: false}; + return { channel: "V2_0", orderer: "V2_0", application: "V2_0", isV2: true, isV3: false }; }; const getVersions = (fabricVersion: string): FabricVersions => { diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index f6b75fd21..a4cc35f1b 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -16,7 +16,6 @@ interface CapabilitiesV2 { isV3: false; } - interface CapabilitiesV_2_5 { application: "V2_5"; channel: "V2_0"; @@ -33,7 +32,6 @@ interface CapabilitiesV3_0 { isV3: true; } - export type Capabilities = CapabilitiesV2 | CapabilitiesV_2_5 | CapabilitiesV3_0; export interface Global extends FabricVersions { diff --git a/src/validate/index.ts b/src/validate/index.ts index 98c80bca0..3d8a3b883 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -466,12 +466,12 @@ class ValidateGenerator extends Generator { _validateDevMode(global: GlobalJson): void { if (global.peerDevMode && global.tls) { - const message = `TLS needs to be disabled when running peers in dev mode`; - this.emit(validationErrorType.ERROR, { category: validationCategories.GENERAL, message }); + const message = `TLS needs to be disabled when running peers in dev mode`; + this.emit(validationErrorType.ERROR, { category: validationCategories.GENERAL, message }); } } - _verifyFabricVersion(global:GlobalJson){ + _verifyFabricVersion(global: GlobalJson) { if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { const message = `Fablo supports Fabric in version 2.0.0 and higher`; this.emit(validationErrorType.ERROR, { category: validationCategories.GENERAL, message }); From 48c91f3d04d58d338afc1b59ba40573e6ce1c842 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:03:44 +0530 Subject: [PATCH 244/471] version 3 changes initiated Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- .../fabric-docker/commands-generated.sh | 15 +++++++++++ .../fabric-docker/scripts/base-functions.sh | 25 ++++++++++++++++--- .../fabric-docker/scripts/cli/channel_fns.sh | 17 ++++++++++++- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 648f046d0..f311f10ee 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -50,9 +50,24 @@ installChannels() { <% if(!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + + <% if (global.capabilities.isV3) { -%> + #wait for channel creation + sleep 5 + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } else { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% if (global.capabilities.isV3) { -%> + #wait for channel creation + sleep 5 + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTLS '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } %> <% } else { -%> printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh index e089bb320..a9e08639e 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh @@ -95,9 +95,15 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + <% if(global.capabilities.isV3){ %> + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + <% } else { %> + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + <% } %> + removeContainer $CONTAINER_NAME } @@ -110,7 +116,18 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + # Assuming 'global_capabilities_isV3' is a predefined variable + <% if(global_capabilities_isV3) {%> + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.pb" + <% } else { %> + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" + <% } %> + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -133,11 +150,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \ --configPath ./fabric-config \ -profile "${CONFIG_PROFILE}" \ - -outputAnchorPeersUpdate ./config/"${MSP_NAME}"anchors.tx \ + -outputAnchorPeersUpdate "${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}"\ -channelID "${CHANNEL_NAME}" \ -asOrg "${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh index f96d6e4cb..a9ddfa31b 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh @@ -21,10 +21,19 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" + <% if(global.capabilities.isV3) { %> cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - + } + <% } else { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + <% } %> + + <% if(global.capabilities.isV3) { %> + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" + <% } else { %> peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block + <% } %> rm -rf "$DIR_NAME" } @@ -56,11 +65,17 @@ createChannelAndJoinTls() { echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" mkdir "$DIR_NAME" && cd "$DIR_NAME" + + <% if(global.capabilities.isV3) { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" + <% } else { %> cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + <% } %> rm -rf "$DIR_NAME" } From 03da1ecdf7de2ab3e9cba4802037e23d9856e09a Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:27:45 +0530 Subject: [PATCH 245/471] added the tests Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05.sh | 93 +++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 e2e-network/docker/test-05.sh diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh new file mode 100644 index 000000000..808b6336f --- /dev/null +++ b/e2e-network/docker/test-05.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +set -eux + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "$6") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" +waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 4 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":6" + +# Reset and ensure the state is lost after reset +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) +waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"error\":\"NOT_FOUND\"}' + +# Put some data again +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "James Bond"]}' \ + '{\"success\":\"OK\"}' \ No newline at end of file From a6fff3678acce8ccee57ed0e68fd4bb6360052c9 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:30:24 +0530 Subject: [PATCH 246/471] added the samples Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- .../fablo-config-hlf3-1orgs-1chaincode.json | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 samples/fablo-config-hlf3-1orgs-1chaincode.json diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json new file mode 100644 index 000000000..2a001c1cf --- /dev/null +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -0,0 +1,59 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "global": { + "fabricVersion": "3.0.0-beta", + "tls": true, + "monitoring": { + "loglevel": "debug" + } + }, + "orgs": [ + { + "organization": { + "name": "Orderer", + "domain": "orderer.example.com" + }, + "orderers": [ + { + "groupName": "group1", + "type": "raft", + "instances": 1 + } + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "peer": { + "instances": 2, + "db": "LevelDb" + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0", + "peer1" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ] + } + \ No newline at end of file From 3931232f6767ef1924df7565b4cac1b1668c1591 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 21:45:28 +0530 Subject: [PATCH 247/471] updated some conditions Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05.sh | 0 .../templates/fabric-docker/commands-generated.sh | 6 +----- .../templates/fabric-docker/docker-compose.yaml | 1 + .../templates/fabric-docker/scripts/cli/channel_fns.sh | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) mode change 100644 => 100755 e2e-network/docker/test-05.sh diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh old mode 100644 new mode 100755 diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index f311f10ee..322445e66 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -155,11 +155,7 @@ upgradeChaincode() { <% chaincodes.forEach((chaincode) => { -%> if [ "$chaincodeName" = "<%= chaincode.name %>" ]; then if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> - <% } else { -%> - <%- include('commands-generated/chaincode-upgrade-v2.sh', { chaincode, global }); %> - <% } -%> + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' upgrade. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 2ec40b3d3..d5fbb033a 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -209,6 +209,7 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 <%_ } _%> working_dir: /var/hyperledger/orderer command: orderer diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh index a9ddfa31b..374f31258 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh @@ -22,8 +22,7 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" <% if(global.capabilities.isV3) { %> - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - } + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . <% } else { %> cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . <% } %> From 0b88ba7bf0d94e9d4c560e37dc98684ff205a580 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Wed, 6 Nov 2024 19:17:24 +0530 Subject: [PATCH 248/471] updated the templates, now version 3 is supported Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- src/extend-config/extendOrgsConfig.ts | 1 + src/setup-docker/index.ts | 13 +- .../templates/fabric-config/configtx.yaml | 6 +- .../{fabric-docker.sh => fabric-docker-v2.sh} | 0 .../templates/fabric-docker-v3.sh | 65 +++++ src/setup-docker/templates/fabric-docker/.env | 9 +- .../fabric-docker/commands-generated.sh | 62 +++-- .../fabric-docker/docker-compose.yaml | 1 + ...base-functions.sh => base-functions-v2.sh} | 21 +- .../scripts/base-functions-v3.sh | 263 ++++++++++++++++++ .../cli/{channel_fns.sh => channel_fns-v2.sh} | 17 +- .../scripts/cli/channel_fns-v3.sh | 123 ++++++++ src/types/FabloConfigExtended.ts | 1 + 14 files changed, 517 insertions(+), 67 deletions(-) rename src/setup-docker/templates/{fabric-docker.sh => fabric-docker-v2.sh} (100%) create mode 100755 src/setup-docker/templates/fabric-docker-v3.sh rename src/setup-docker/templates/fabric-docker/scripts/{base-functions.sh => base-functions-v2.sh} (90%) create mode 100644 src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh rename src/setup-docker/templates/fabric-docker/scripts/cli/{channel_fns.sh => channel_fns-v2.sh} (87%) create mode 100644 src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 2a001c1cf..f20b46de1 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.1-unstable.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, diff --git a/src/extend-config/extendOrgsConfig.ts b/src/extend-config/extendOrgsConfig.ts index 264aa911c..c2661f20e 100644 --- a/src/extend-config/extendOrgsConfig.ts +++ b/src/extend-config/extendOrgsConfig.ts @@ -61,6 +61,7 @@ const extendOrderersConfig = ( orgMspName, domain: ordererOrgDomainJson, consensus, + adminPort: 7053, port, fullAddress: `${address}:${port}`, }; diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 560eb1e8a..762b3f567 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -213,20 +213,15 @@ export default class SetupDockerGenerator extends Generator { } _copyUtilityScripts(capabilities: Capabilities): void { - this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); + this.fs.copyTpl(this.templatePath(`fabric-docker-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/cli/channel_fns.sh"), + this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), ); this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/cli/channel_fns.sh"), - this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), - ); - - this.fs.copyTpl( - this.templatePath("fabric-docker/scripts/base-functions.sh"), + this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker/scripts/base-functions.sh"), ); @@ -241,7 +236,7 @@ export default class SetupDockerGenerator extends Generator { ); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/chaincode-functions-${capabilities.isV2 ? "v2" : "v1.4"}.sh`), + this.templatePath(`fabric-docker/scripts/chaincode-functions-${capabilities.isV2 ? "v2" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/chaincode-functions.sh"), ); } diff --git a/src/setup-docker/templates/fabric-config/configtx.yaml b/src/setup-docker/templates/fabric-config/configtx.yaml index c3f81a43d..95c5d4d0f 100755 --- a/src/setup-docker/templates/fabric-config/configtx.yaml +++ b/src/setup-docker/templates/fabric-config/configtx.yaml @@ -158,19 +158,23 @@ Profiles: <%_ channel.ordererGroup.hostingOrgs.forEach(function(hostingOrg) { _%> - *<%= hostingOrg %> <%_ }) _%> + <%_ if (!global.capabilities.isV3) { _%> Capabilities: <<: *ApplicationCapabilities + <%_ } _%> Consortium: SampleConsortium + <%_ if (!global.capabilities.isV3) { _%> Consortiums: SampleConsortium: Organizations: <%_ channel.orgs.forEach(function(org){ _%> - *<%= org.name %> <%_ }) _%> + <%_ } _%> Application: <<: *ApplicationDefaults Organizations: <%_ channel.orgs.forEach(function(org){ _%> - *<%= org.name %> <%_ }) _%> - <%_ }) _%> + <%_ }) _%> \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker.sh b/src/setup-docker/templates/fabric-docker-v2.sh similarity index 100% rename from src/setup-docker/templates/fabric-docker.sh rename to src/setup-docker/templates/fabric-docker-v2.sh diff --git a/src/setup-docker/templates/fabric-docker-v3.sh b/src/setup-docker/templates/fabric-docker-v3.sh new file mode 100755 index 000000000..db605e0a2 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker-v3.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index 90880f6af..1fef13821 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -17,9 +17,12 @@ FABRIC_CA_VERSION=<%= global.fabricCaVersion %> FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %> -FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %> -FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %> -RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %> + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 322445e66..5842909e9 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -41,37 +41,54 @@ generateChannelsArtifacts() { installChannels() { <% if (!channels || !channels.length) { -%> echo "No channels" - <% } else { -%> + <% } else if (global.capabilities.isV3) { -%> <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> - <% if(orgNo == 0 && peerNo == 0) { -%> + <% if (orgNo == 0 && peerNo == 0) { -%> printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" - <% if(!global.tls) { -%> + <% if (!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" - - <% if (global.capabilities.isV3) { -%> - #wait for channel creation + "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" sleep 5 - docker exec -i <%= org.cli.address %> bash -c <% -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" - <% } -%> - <% } else { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" - <% if (global.capabilities.isV3) { -%> - #wait for channel creation + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" sleep 5 - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; fetchChannelAndJoinTLS '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" - <% } -%> - + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" <% } %> <% } else { -%> - printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" - <% if(!global.tls) { -%> + printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" + <% if (!global.tls) { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } else { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% } -%> + <% } -%> + <% }) -%> + <% }) -%> + <% }) -%> + <% } else { -%> + <% channels.forEach((channel) => { -%> + <% channel.orgs.forEach((org, orgNo) => { -%> + <% org.peers.forEach((peer, peerNo) => { -%> + <% if (orgNo == 0 && peerNo == 0) { -%> + printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" + <% if (!global.tls) { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" + <% } else { -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" + <% } %> + <% } else { -%> + printItalics "Joining '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F638" + <% if (!global.tls) { -%> docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" <% } else { -%> @@ -85,20 +102,19 @@ installChannels() { <% } -%> } + installChaincodes() { <% if (!chaincodes || !chaincodes.length) { -%> echo "No chaincodes" <% } else { -%> <% chaincodes.forEach((chaincode) => { -%> if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> <% if (global.peerDevMode) { -%> <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> <% } else { -%> local version="<%= chaincode.version %>" <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> <% } -%> - <% } -%> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" @@ -117,9 +133,7 @@ installChaincode() { <% chaincodes.forEach((chaincode) => { -%> if [ "$chaincodeName" = "<%= chaincode.name %>" ]; then if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.capabilities.isV2) { -%> - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> - <% } -%> + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); %> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' install. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index d5fbb033a..08413f723 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -243,6 +243,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=${LOGGING_LEVEL} diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh similarity index 90% rename from src/setup-docker/templates/fabric-docker/scripts/base-functions.sh rename to src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index a9e08639e..b3aef4836 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -96,13 +96,9 @@ createChannelTx() { docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - <% if(global.capabilities.isV3){ %> - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - <% } else { %> + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - <% } %> removeContainer $CONTAINER_NAME @@ -117,16 +113,11 @@ createNewChannelUpdateTx() { local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - # Assuming 'global_capabilities_isV3' is a predefined variable - <% if(global_capabilities_isV3) {%> - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" - CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.pb" - <% } else { %> - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" - <% } %> + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh new file mode 100644 index 000000000..f24fce658 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -0,0 +1,263 @@ +#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "${dir}"/*_sk "${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".pb + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" + docker cp $CONTAINER_NAME:/config/channel.pb "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.pb" + + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \ + --configPath ./fabric-config \ + -profile "${CONFIG_PROFILE}" \ + -outputAnchorPeersUpdate "${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}"\ + -channelID "${CHANNEL_NAME}" \ + -asOrg "${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \ + "$CLI_NAME" peer channel update \ + -c "$CHANNEL_NAME" \ + -o "$ORDERER_URL" \ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \ + "$CLI_NAME" peer channel update \ + -c "$CHANNEL_NAME" \ + -o "$ORDERER_URL" \ + -f "$ANCHOR_PEER_UPDATE_PATH" \ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\e[1m' + end=$'\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "${bold}============ %b %s %b ==============${end}\n" "\\$EMOJI" "$TEXT" "\\$EMOJI" +} + +printItalics() { + italics=$'\e[3m' + end=$'\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "${italics}==== %b %s %b ====${end}\n" "\\$EMOJI" "$TEXT" "\\$EMOJI" +} + +inputLog() { + end=$'\e[0m' + darkGray=$'\e[90m' + + echo "${darkGray} $1 ${end}" +} + +inputLogShort() { + end=$'\e[0m' + darkGray=$'\e[90m' + + echo "${darkGray} $1 ${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh similarity index 87% rename from src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh rename to src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh index 374f31258..fad11a6fe 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh @@ -21,18 +21,10 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - <% if(global.capabilities.isV3) { %> - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . - <% } else { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - <% } %> - - <% if(global.capabilities.isV3) { %> - osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" - <% } else { %> peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block - <% } %> rm -rf "$DIR_NAME" } @@ -65,16 +57,13 @@ createChannelAndJoinTls() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - <% if(global.capabilities.isV3) { %> - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . - osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" - <% } else { %> + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - <% } %> + rm -rf "$DIR_NAME" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh new file mode 100644 index 000000000..88be1167c --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" + peer channel join -b "${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): ${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index a4cc35f1b..266f433ad 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -47,6 +47,7 @@ export interface OrdererConfig { name: string; domain: string; address: string; + adminPort: number; port: number; fullAddress: string; orgName: string; From abb5499a5edb0933e402cb3488bac4f1be978f65 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 13 Nov 2024 10:46:17 +0530 Subject: [PATCH 249/471] Successfully pass the tests Signed-off-by: Sanket Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05.sh | 25 +++---- src/setup-docker/index.ts | 2 +- .../templates/fabric-docker-v3.sh | 65 ------------------- .../{fabric-docker-v2.sh => fabric-docker.sh} | 0 .../fabric-docker/commands-generated.sh | 13 +++- .../scripts/base-functions-v3.sh | 22 ++++--- 6 files changed, 34 insertions(+), 93 deletions(-) delete mode 100755 src/setup-docker/templates/fabric-docker-v3.sh rename src/setup-docker/templates/{fabric-docker-v2.sh => fabric-docker.sh} (100%) diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh index 808b6336f..94fa62801 100755 --- a/e2e-network/docker/test-05.sh +++ b/e2e-network/docker/test-05.sh @@ -6,6 +6,8 @@ TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." +export FABLO_HOME + CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" networkUp() { @@ -36,7 +38,7 @@ waitForChaincode() { } expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "$6") + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") } expectCommand() { @@ -49,8 +51,8 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT # start the network networkUp -waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" -waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" @@ -71,23 +73,12 @@ expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 4 my-channel1 org1 peer1 "another.block") +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":6" +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" -# Reset and ensure the state is lost after reset -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) -waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"error\":\"NOT_FOUND\"}' - -# Put some data again -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "James Bond"]}' \ - '{\"success\":\"OK\"}' \ No newline at end of file +echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 762b3f567..36711d822 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -213,7 +213,7 @@ export default class SetupDockerGenerator extends Generator { } _copyUtilityScripts(capabilities: Capabilities): void { - this.fs.copyTpl(this.templatePath(`fabric-docker-${capabilities.isV3? "v3": "v2"}.sh`), this.destinationPath("fabric-docker.sh")); + this.fs.copyTpl(this.templatePath(`fabric-docker.sh`), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), diff --git a/src/setup-docker/templates/fabric-docker-v3.sh b/src/setup-docker/templates/fabric-docker-v3.sh deleted file mode 100755 index db605e0a2..000000000 --- a/src/setup-docker/templates/fabric-docker-v3.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker-v2.sh b/src/setup-docker/templates/fabric-docker.sh similarity index 100% rename from src/setup-docker/templates/fabric-docker-v2.sh rename to src/setup-docker/templates/fabric-docker.sh diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 5842909e9..8d1f81fe3 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -13,9 +13,14 @@ generateArtifacts() { <% }) -%> <%_ ordererGroups.forEach((ordererGroup) => { _%> + + <% if(!global.capabilities.isV3) {%> printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" - + <% } else { %> + echo "System channel not supported for Fabric version 3" + <% } %> + <%_ }) _%> # Create directory for chaincode packages to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" @@ -179,6 +184,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + <% if(!global.capabilities.isV3) { %> printHeadline "Creating new channel config blocks" "U1F537" <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org) => { -%> @@ -219,6 +225,11 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "<%= channel.name %>" "<%= org.mspName %>" "<%= org.cli.address %>" <% }) -%> <% }) -%> + + <% } else { %> + echo "" + <% } %> + } printStartSuccessInfo() { diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index f24fce658..27f572e33 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -77,7 +77,8 @@ createChannelTx() { local CONFIG_PATH=$2 local CONFIG_PROFILE=$3 local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".pb + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + echo CHNANEL_TX_PATH: $CHANNEL_TX_PATH echo "Creating channelTx for $CHANNEL_NAME..." inputLog "CONFIG_PATH: $CONFIG_PATH" @@ -91,17 +92,20 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker run --rm \ + --name $CONTAINER_NAME \ + -v "$CONFIG_PATH":/fabric-config \ + -v "$OUTPUT_PATH":/output \ + hyperledger/fabric-tools:"${FABRIC_VERSION}" \ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputBlock ./config/channel.pb -channelID "${CHANNEL_NAME}" - docker cp $CONTAINER_NAME:/config/channel.pb "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + echo "Channel configuration created at $CHANNEL_TX_PATH" - removeContainer $CONTAINER_NAME } createNewChannelUpdateTx() { From 26ca71c79015ce64ca7a6b96459dfe8539ef3a68 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 13 Nov 2024 12:05:54 +0530 Subject: [PATCH 250/471] updated testCases.md Signed-off-by: Sanket Signed-off-by: Pereowei Daniel --- e2e-network/TEST_CASES.md | 40 +++++++++---------- .../{test-05.sh => test-05-version3.sh} | 0 2 files changed, 20 insertions(+), 20 deletions(-) rename e2e-network/docker/{test-05.sh => test-05-version3.sh} (100%) diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 247a98de7..80a71df03 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | -| TLS | no | yes | no | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | -| Consensus | solo | RAFT | solo | RAFT | -| Orderer nodes | 1 | 3 | 1 | 1 | -| Organizations | 1 | 2 | 2 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | -| Channels | 1 | 2 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | -| Private data | no | no | yes | yes | -| Java chaincode | no | yes | no | no | -| Go chaincode | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | +| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 1 | +| Organizations | 1 | 2 | 2 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | +| Private data | no | no | yes | yes | no | +| Java chaincode | no | yes | no | no | no | +| Go chaincode | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05-version3.sh similarity index 100% rename from e2e-network/docker/test-05.sh rename to e2e-network/docker/test-05-version3.sh From 3cdd4876fd22255924329b4c736a407070fb5fac Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Sun, 1 Dec 2024 23:37:31 +0530 Subject: [PATCH 251/471] increased the number of instances for the orderers Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index f20b46de1..1286f962e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -17,7 +17,7 @@ { "groupName": "group1", "type": "raft", - "instances": 1 + "instances": 3 } ] }, From bcb18ebedae5b48819b0cda1fd8368f49597c6cf Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Mon, 2 Dec 2024 10:56:36 +0530 Subject: [PATCH 252/471] minor changes Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- .../fabric-docker/commands-generated.sh | 15 ++++++------- .../scripts/cli/channel_fns-v3.sh | 21 ++++++++----------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 8d1f81fe3..7e3d1717a 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -44,24 +44,26 @@ generateChannelsArtifacts() { } installChannels() { + set -x <% if (!channels || !channels.length) { -%> + echo "No channels" <% } else if (global.capabilities.isV3) { -%> <% channels.forEach((channel) => { -%> + <% channel.ordererGroup.orderers.forEach((orderer) => { -%> + <% const org = orgs.find((org) => org.name === orderer.orgName); -%> + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' 'example.com' 'crypto/users/Admin@test/msp' '<%= orderer.address %>:<%= orderer.adminPort %>';" + <% }) -%> + sleep 8 <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> printHeadline "Creating '<%= channel.name %>' on <%= org.name %>/<%= peer.name %>" "U1F63B" <% if (!global.tls) { -%> - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" - sleep 5 docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoin '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' '<%= channel.ordererHead.fullAddress %>';" <% } else { -%> - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.address %>:<%= channel.ordererHead.adminPort %>';" - sleep 5 docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; fetchChannelAndJoinTls '<%= channel.name %>' '<%= org.mspName %>' '<%= peer.fullAddress %>' 'crypto/users/Admin@<%= org.domain %>/msp' 'crypto/users/Admin@<%= org.domain %>/tls' 'crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem' '<%= channel.ordererHead.fullAddress %>';" <% } %> @@ -107,7 +109,6 @@ installChannels() { <% } -%> } - installChaincodes() { <% if (!chaincodes || !chaincodes.length) { -%> echo "No chaincodes" diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 88be1167c..8f81e8824 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -33,14 +33,11 @@ createChannelAndJoinTls() { local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 + local ORDERER_URL=$5 - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + # local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + # local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + # local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -48,11 +45,11 @@ createChannelAndJoinTls() { echo " Orderer: $ORDERER_URL" echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + # echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + # echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + # echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + # echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + # echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" mkdir "$DIR_NAME" && cd "$DIR_NAME" From c3f2eb5b74264ef1e26ac9c124c22a94ec54c299 Mon Sep 17 00:00:00 2001 From: Sanket Date: Wed, 13 Nov 2024 16:06:48 +0530 Subject: [PATCH 253/471] done with initial configuration for BFT, updated the templates for the same Signed-off-by: Sanket Signed-off-by: Pereowei Daniel --- docs/schema.json | 3 +- e2e-network/docker/test-05-version3-BFT.sh | 84 +++++++++++++++++++ .../fablo-config-hlf3-1orgs-1chaincode.json | 4 +- ...ablo-config-hlf3-bft-1orgs-1chaincode.json | 60 +++++++++++++ .../configtx-raft-template.yaml.ejs | 12 +++ src/types/FabloConfigExtended.ts | 2 +- src/types/FabloConfigJson.ts | 2 +- 7 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 e2e-network/docker/test-05-version3-BFT.sh create mode 100644 samples/fablo-config-hlf3-bft-1orgs-1chaincode.json diff --git a/docs/schema.json b/docs/schema.json index fd5981002..2f411465c 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -224,7 +224,8 @@ "description": "The 'solo' consensus type may be used in development environment only. Use 'raft' in production.", "enum": [ "solo", - "raft" + "raft", + "BFT" ] }, "instances": { diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh new file mode 100644 index 000000000..b5d566dd6 --- /dev/null +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +set -eux + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +export FABLO_HOME + +CONFIG="$FABLO_HOME/fablo-config-hlf3-bft-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" + +echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 1286f962e..c56c53c18 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -16,8 +16,8 @@ "orderers": [ { "groupName": "group1", - "type": "raft", - "instances": 3 + "type": "BFT", + "instances": 4 } ] }, diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json new file mode 100644 index 000000000..8f90718a6 --- /dev/null +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -0,0 +1,60 @@ +{ + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "global": { + "fabricVersion": "3.0.0-beta", + "tls": true, + "monitoring": { + "loglevel": "debug" + } + }, + "orgs": [ + { + "organization": { + "name": "Orderer", + "domain": "orderer.example.com" + }, + "orderers": [ + { + "groupName": "group1", + "type": "BFT", + "instances": 4 + } + + ] + }, + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + }, + "peer": { + "instances": 2, + "db": "LevelDb" + } + } + ], + "channels": [ + { + "name": "my-channel1", + "orgs": [ + { + "name": "Org1", + "peers": [ + "peer0", + "peer1" + ] + } + ] + } + ], + "chaincodes": [ + { + "name": "chaincode1", + "version": "0.0.1", + "lang": "node", + "channel": "my-channel1", + "directory": "./chaincodes/chaincode-kv-node" + } + ] + } + \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index 8f7ddc6f9..ef7ad0fee 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -6,3 +6,15 @@ ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt <% })} -%> + +<% if (ordererGroup.consensus == "BFT") { %> + smartBFT: + ConsenterMapping:<% ordererGroup.orderers.forEach(function(orderer, index) { %> + - ID: <%= index+1 %> + Host: <%= orderer.address %> + Port: <%= orderer.port %> + MSPID: <%= orderer.orgMspName %> + Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/tlscacerts/tlsca.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt +<% })} -%> diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 266f433ad..3a20c75d9 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -160,7 +160,7 @@ export interface ChaincodeConfig { export interface OrdererGroup { name: string; - consensus: "solo" | "etcdraft"; + consensus: "solo" | "etcdraft" | "BFT"; profileName: string; genesisBlockName: string; configtxOrdererDefaults: string; diff --git a/src/types/FabloConfigJson.ts b/src/types/FabloConfigJson.ts index b2bb11eef..bc50f916b 100644 --- a/src/types/FabloConfigJson.ts +++ b/src/types/FabloConfigJson.ts @@ -21,7 +21,7 @@ export interface CAJson { export interface OrdererJson { groupName: string; prefix: string; - type: "solo" | "raft"; + type: "solo" | "raft" | "BFT"; instances: number; } From 9c999d6f90183f30a4dde3352c9657359f662cb1 Mon Sep 17 00:00:00 2001 From: Sanket Date: Fri, 22 Nov 2024 09:23:28 +0530 Subject: [PATCH 254/471] updated the permission Signed-off-by: Sanket Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05-version3-BFT.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 e2e-network/docker/test-05-version3-BFT.sh diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh old mode 100644 new mode 100755 From 6891165674b4c02efe5382fbec02ad0e6de37176 Mon Sep 17 00:00:00 2001 From: Sanket Date: Fri, 22 Nov 2024 18:15:10 +0530 Subject: [PATCH 255/471] version 3 completed heading towards adding BFT support Signed-off-by: Sanket Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05-version3-BFT.sh | 2 +- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- .../fabric-config/configtx-raft-template.yaml.ejs | 15 ++++++++++++++- .../fabric-docker/scripts/cli/channel_fns-v3.sh | 7 +++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index b5d566dd6..179d2c531 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -8,7 +8,7 @@ FABLO_HOME="$TEST_TMP/../../.." export FABLO_HOME -CONFIG="$FABLO_HOME/fablo-config-hlf3-bft-1orgs-1chaincode.json" +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json" networkUp() { "$FABLO_HOME/fablo-build.sh" diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index c56c53c18..467c2920e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -16,7 +16,7 @@ "orderers": [ { "groupName": "group1", - "type": "BFT", + "type": "raft", "instances": 4 } ] diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index ef7ad0fee..8218b70b8 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -8,7 +8,20 @@ <% })} -%> <% if (ordererGroup.consensus == "BFT") { %> - smartBFT: + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 ConsenterMapping:<% ordererGroup.orderers.forEach(function(orderer, index) { %> - ID: <%= index+1 %> Host: <%= orderer.address %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 8f81e8824..6eaf90ce5 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -33,18 +33,21 @@ createChannelAndJoinTls() { local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 + # local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + # local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + # local TLS_CA_CERT_PATH=$(realpath "$6") local ORDERER_URL=$5 # local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt # local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key # local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_LOCALMSPID echo "Creating channel with name (TLS): ${CHANNEL_NAME}" echo " Orderer: $ORDERER_URL" echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + # echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" # echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" # echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" # echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" From b47dc13fd0a289600589cc96b969e77c82e8b1ab Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 10:10:34 +0100 Subject: [PATCH 256/471] Use proper createChannelAndJoinTls with certs Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .../fabric-docker/commands-generated.sh | 4 +- .../scripts/cli/channel_fns-v3.sh | 50 +++++++++---------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 7e3d1717a..7644abc36 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -53,9 +53,9 @@ installChannels() { <% channel.ordererGroup.orderers.forEach((orderer) => { -%> <% const org = orgs.find((org) => org.name === orderer.orgName); -%> docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' 'example.com' 'crypto/users/Admin@test/msp' '<%= orderer.address %>:<%= orderer.adminPort %>';" + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> - sleep 8 + sleep 8 # TODO: remove sleep <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 6eaf90ce5..1b51468aa 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -30,36 +30,34 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - # local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - # local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - # local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$5 - - # local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - # local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - # local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_LOCALMSPID + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME echo "Creating channel with name (TLS): ${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - # echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - # echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - # echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - # echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - # echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - # echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \ + --channelID "${CHANNEL_NAME}" \ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \ + -o "${ORDERER_ADMIN_ADDRESS}" \ + --client-cert "${ADMIN_TLS_SIGN_CERT}" \ + --client-key "${ADMIN_TLS_PRIVATE_KEY}" \ + --ca-file "${TLS_CA_CERT_PATH}" - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . - osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" # --ca-file "${TLS_CA_CERT_PATH}" --client-cert "${ADMIN_SIGN_CERT}" --client-key "${ADMIN_PRIVATE_KEY}" - rm -rf "$DIR_NAME" } From 25f996a549c50c0ebe04078e097bdf6b400d42ba Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 10:19:48 +0100 Subject: [PATCH 257/471] Enable TLS for admin endpoints Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .../templates/fabric-docker/docker-compose.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 08413f723..1552ba3a1 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -189,6 +189,7 @@ services: - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=<%= orderer.port %> - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 <%_ if(global.capabilities.isV2) { _%> - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> <%_ } else { _%> @@ -203,13 +204,17 @@ services: - ORDERER_METRICS_PROVIDER=prometheus # enabled TLS - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] <%_ } _%> working_dir: /var/hyperledger/orderer command: orderer From d9e0bd3259179f61ca08bae143869e88ddae3502 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:14:17 +0100 Subject: [PATCH 258/471] Reorder and fix docker compose variable for orderer Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .../fabric-docker/docker-compose.yaml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 1552ba3a1..3b93c52d5 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -188,34 +188,34 @@ services: - FABRIC_LOGGING_SPEC=${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=<%= orderer.port %> - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_ADMIN_LISTENADDRESS=<%= orderer.address %>:7053 - <%_ if(global.capabilities.isV2) { _%> - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> - <%_ } else { _%> - - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> - <%_ } _%> - - ORDERER_GENERAL_LOCALMSPID=<%= org.mspName %> + - ORDERER_GENERAL_LOCALMSPID=<%= orderer.orgMspName %> - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go <%_ if(global.tls) { _%> - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=<%= orderer.address %>:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + <%_ } _%> + <%_ if(global.capabilities.isV3) { _%> + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration - ORDERER_ADMIN_TLS_ENABLED=true - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:<%= orderer.adminPort %> <%_ } _%> + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=<%= orderer.address %>:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: From 30904af77585ed1f189e31de152d3bf9252253de Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:14:39 +0100 Subject: [PATCH 259/471] Fix identity which remove NOT_FOUND error while fetching the channel Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .../templates/fabric-config/configtx-raft-template.yaml.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs index 8218b70b8..73a4334f1 100755 --- a/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs +++ b/src/setup-docker/templates/fabric-config/configtx-raft-template.yaml.ejs @@ -27,7 +27,7 @@ Host: <%= orderer.address %> Port: <%= orderer.port %> MSPID: <%= orderer.orgMspName %> - Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/tlscacerts/tlsca.orderer.example.com-cert.pem + Identity: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/msp/signcerts/<%= orderer.address %>-cert.pem ClientTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/<%= orderer.domain %>/peers/<%= orderer.address %>/tls/server.crt <% })} -%> From 6249af4076bc86ec4b88377c1ea89198ef2fcbd1 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:15:24 +0100 Subject: [PATCH 260/471] Remove unnecessary sleep Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/fabric-docker/commands-generated.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 7644abc36..cf717aa61 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -55,7 +55,6 @@ installChannels() { docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> - sleep 8 # TODO: remove sleep <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> From aa2873ff4c9315315aed3cba7735b12a0e192ab9 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:50:01 +0100 Subject: [PATCH 261/471] Fix docker compose variables for RAFT Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 3b93c52d5..405052deb 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -201,6 +201,11 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] <%_ } _%> + <%_ if(ordererGroup.consensus !== "BFT" && global.capabilities.isV2) { _%> + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> + <%_ } _%> <%_ if(global.capabilities.isV3) { _%> # V3 specific settings - ORDERER_GENERAL_BOOTSTRAPMETHOD=none From 1ea666636d38a8e0696128eb549cba1939a742d7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 30 Nov 2024 11:50:20 +0100 Subject: [PATCH 262/471] Some polishing and cleanup Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .../templates/fabric-docker/commands-generated.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index cf717aa61..15a12d994 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -15,10 +15,8 @@ generateArtifacts() { <%_ ordererGroups.forEach((ordererGroup) => { _%> <% if(!global.capabilities.isV3) {%> - printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" - <% } else { %> - echo "System channel not supported for Fabric version 3" + printItalics "Generating genesis block for group <%= ordererGroup.name %>" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "<%= ordererGroup.profileName %>" <% } %> <%_ }) _%> @@ -44,9 +42,7 @@ generateChannelsArtifacts() { } installChannels() { - set -x <% if (!channels || !channels.length) { -%> - echo "No channels" <% } else if (global.capabilities.isV3) { -%> <% channels.forEach((channel) => { -%> @@ -55,6 +51,9 @@ installChannels() { docker exec -i <%= org.cli.address %> bash -c <% -%> "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> + <% if (channel.ordererGroup.consensus !== "BFT") { -%> + sleep 4 # Wait for Raft cluster to establish consensus + <% } -%> <% channel.orgs.forEach((org, orgNo) => { -%> <% org.peers.forEach((peer, peerNo) => { -%> <% if (orgNo == 0 && peerNo == 0) { -%> From 1f296b5a5bde6b53c7e4d366362ba48e7bf2a454 Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:39:26 +0530 Subject: [PATCH 263/471] Update src/setup-docker/templates/fabric-docker/docker-compose.yaml Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 405052deb..e26060fd3 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -201,7 +201,7 @@ services: - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] <%_ } _%> - <%_ if(ordererGroup.consensus !== "BFT" && global.capabilities.isV2) { _%> + <%_ if(global.capabilities.isV2) { _%> # Genesis file configuration (for solo and raft) - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/<%= ordererGroup.genesisBlockName %> From 5daa7620fb7458cd6fe9b97622746d66122350ea Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 12:45:53 +0530 Subject: [PATCH 264/471] updated the snapshots Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 2147 +++++++++++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 40 +- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 36 +- ...2chaincodes-private-data.yaml.test.ts.snap | 41 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 99 +- ...1chaincode-raft-explorer.json.test.ts.snap | 160 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 56 + e2e/__snapshots__/schema.test.ts.snap | 1 + samples/invalid-fablo-config.json | 2 +- 9 files changed, 2432 insertions(+), 150 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index a926ccf3f..84c005f6b 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -103,6 +103,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -114,6 +115,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -126,6 +128,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -139,6 +142,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -435,6 +439,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -446,6 +451,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -458,6 +464,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -471,6 +478,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -603,6 +611,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -623,6 +632,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -634,6 +644,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -646,6 +657,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -692,6 +704,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -704,6 +717,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -914,6 +928,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -925,6 +940,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -937,6 +953,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -950,6 +967,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1246,6 +1264,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1257,6 +1276,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1269,6 +1289,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1282,6 +1303,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1414,6 +1436,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1434,6 +1457,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1445,6 +1469,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1457,6 +1482,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1503,6 +1529,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1515,6 +1542,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1720,6 +1748,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1731,6 +1760,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1743,6 +1773,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -1756,6 +1787,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2037,6 +2069,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2048,6 +2081,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2060,6 +2094,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2073,6 +2108,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2205,6 +2241,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2225,6 +2262,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2236,6 +2274,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2248,6 +2287,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2294,6 +2334,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2306,6 +2347,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2511,6 +2553,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2522,6 +2565,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2534,6 +2578,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2547,6 +2592,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2915,6 +2961,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2926,6 +2973,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2938,6 +2986,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -2951,6 +3000,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3320,6 +3370,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3331,6 +3382,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3343,6 +3395,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3356,6 +3409,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3551,6 +3605,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3571,6 +3626,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3582,6 +3638,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3594,6 +3651,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3640,6 +3698,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3652,6 +3711,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -3930,6 +3990,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3941,6 +4002,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3953,6 +4015,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -3963,6 +4026,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -3973,6 +4037,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -3986,6 +4051,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4371,6 +4437,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4382,6 +4449,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4394,6 +4462,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4404,6 +4473,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -4414,6 +4484,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -4427,6 +4498,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4813,6 +4885,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4824,6 +4897,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4836,6 +4910,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -4846,6 +4921,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -4856,6 +4932,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -4869,6 +4946,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5152,6 +5230,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5163,6 +5242,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5175,6 +5255,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5185,6 +5266,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5195,6 +5277,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -5208,6 +5291,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5503,6 +5587,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group2", "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5514,6 +5599,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5526,6 +5612,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5539,6 +5626,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5775,6 +5863,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5785,6 +5874,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5805,6 +5895,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5816,6 +5907,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5828,6 +5920,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5838,6 +5931,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5848,6 +5942,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -5869,6 +5964,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "name": "group2", "ordererHead": { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5880,6 +5976,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5892,6 +5989,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -5938,6 +6036,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5950,6 +6049,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer0.group1.orderer1.com:7030", @@ -5960,6 +6060,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer1.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer1.group1.orderer1.com:7031", @@ -5970,6 +6071,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, { "address": "orderer2.group1.orderer1.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer1.com", "fullAddress": "orderer2.group1.orderer1.com:7032", @@ -6019,6 +6121,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "ordererHeads": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -6031,6 +6134,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "orderers": [ { "address": "orderer0.group2.orderer2.com", + "adminPort": 7053, "consensus": "solo", "domain": "orderer2.com", "fullAddress": "orderer0.group2.orderer2.com:7050", @@ -6316,6 +6420,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6328,6 +6433,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6338,6 +6444,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6393,6 +6500,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6404,6 +6512,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6414,6 +6523,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6424,6 +6534,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -6434,6 +6545,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -6446,6 +6558,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6456,6 +6569,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -6466,6 +6580,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6476,6 +6591,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6486,6 +6602,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -6496,6 +6613,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -6506,6 +6624,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -6516,6 +6635,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -6529,6 +6649,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6607,6 +6728,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6619,6 +6741,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6629,6 +6752,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6745,6 +6869,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6757,6 +6882,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6767,6 +6893,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6886,6 +7013,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6898,6 +7026,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6908,6 +7037,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -6963,6 +7093,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6974,6 +7105,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -6984,6 +7116,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -6994,6 +7127,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7004,6 +7138,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7016,6 +7151,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7026,6 +7162,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7036,6 +7173,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7046,6 +7184,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7056,6 +7195,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7066,6 +7206,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7076,6 +7217,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7086,6 +7228,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7099,6 +7242,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7177,6 +7321,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7189,6 +7334,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7199,6 +7345,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7313,6 +7460,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7325,6 +7473,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7335,6 +7484,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7390,6 +7540,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7401,6 +7552,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7411,6 +7563,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7421,6 +7574,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7431,6 +7585,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7443,6 +7598,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7453,6 +7609,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7463,6 +7620,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7473,6 +7631,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7483,6 +7642,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7493,6 +7653,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7503,6 +7664,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7513,6 +7675,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7526,6 +7689,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7604,6 +7768,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7616,6 +7781,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7626,6 +7792,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7740,6 +7907,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7752,6 +7920,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7762,6 +7931,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7817,6 +7987,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7828,6 +7999,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7838,6 +8010,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7848,6 +8021,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7858,6 +8032,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7870,6 +8045,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -7880,6 +8056,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -7890,6 +8067,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -7900,6 +8078,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -7910,6 +8089,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -7920,6 +8100,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -7930,6 +8111,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -7940,6 +8122,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -7953,6 +8136,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8031,6 +8215,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8043,6 +8228,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8053,6 +8239,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8163,6 +8350,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8175,6 +8363,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8185,6 +8374,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8267,6 +8457,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8277,6 +8468,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8287,6 +8479,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8297,6 +8490,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8320,6 +8514,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8331,6 +8526,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8341,6 +8537,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8351,6 +8548,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8361,6 +8559,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8373,6 +8572,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8383,6 +8583,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -8393,6 +8594,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8403,6 +8605,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8413,6 +8616,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8423,6 +8627,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8433,6 +8638,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8443,6 +8649,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -8489,6 +8696,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8501,6 +8709,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -8511,6 +8720,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer1.group1.orderer.example.com:7031", @@ -8596,6 +8806,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8608,6 +8819,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer0.group1.org1.example.com:7050", @@ -8618,6 +8830,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org1.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org1.example.com", "fullAddress": "orderer1.group1.org1.example.com:7051", @@ -8728,6 +8941,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8740,6 +8954,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer0.group1.org2.example.com:7070", @@ -8750,6 +8965,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org2.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org2.example.com", "fullAddress": "orderer1.group1.org2.example.com:7071", @@ -8860,6 +9076,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "ordererHeads": [ { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8872,6 +9089,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "orderers": [ { "address": "orderer0.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer0.group1.org3.example.com:7090", @@ -8882,6 +9100,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, { "address": "orderer1.group1.org3.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "org3.example.com", "fullAddress": "orderer1.group1.org3.example.com:7091", @@ -8927,6 +9146,1920 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. } `; +exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": "AND ('Org1MSP.member')", + "init": "{"Args":[]}", + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_5", + "channel": "V3_0", + "isV2": false, + "isV3": true, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "3.0.0-beta", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "3.0.0-beta", + "fabricJavaenvVersion": "3.0", + "fabricNodeenvVersion": "3.0", + "fabricRecommendedNodeVersion": "16", + "fabricVersion": "3.0.0-beta", + "monitoring": { + "loglevel": "debug", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": {}, + }, + "hooks": { + "postGenerate": "", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "ORDERER_CA_ADMIN_NAME", + "caAdminPassVar": "ORDERER_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-orderer", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "OrdererMSP", + "name": "Orderer", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "etcdraft", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], +} +`; + +exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +{ + "chaincodes": [ + { + "channel": { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + "directory": "./chaincodes/chaincode-kv-node", + "endorsement": "AND ('Org1MSP.member')", + "init": "{"Args":[]}", + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "lang": "node", + "name": "chaincode1", + "privateData": [], + "privateDataConfigFile": undefined, + "version": "0.0.1", + }, + ], + "channels": [ + { + "instantiatingOrg": { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + "name": "my-channel1", + "ordererGroup": { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "orgs": [ + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], + "profileName": "MyChannel1", + }, + ], + "global": { + "capabilities": { + "application": "V2_5", + "channel": "V3_0", + "isV2": false, + "isV3": true, + "orderer": "V2_0", + }, + "engine": "docker", + "fabricBaseosVersion": "3.0.0-beta", + "fabricCaVersion": "1.5.5", + "fabricCcenvVersion": "3.0.0-beta", + "fabricJavaenvVersion": "3.0", + "fabricNodeenvVersion": "3.0", + "fabricRecommendedNodeVersion": "16", + "fabricVersion": "3.0.0-beta", + "monitoring": { + "loglevel": "debug", + }, + "paths": { + "chaincodesBaseDir": "", + "fabloConfig": "", + }, + "tls": true, + "tools": {}, + }, + "hooks": { + "postGenerate": "", + }, + "orderedHeadsDistinct": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHead": { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "orgs": [ + { + "anchorPeers": [], + "bootstrapPeers": """", + "ca": { + "address": "ca.orderer.example.com", + "caAdminNameVar": "ORDERER_CA_ADMIN_NAME", + "caAdminPassVar": "ORDERER_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7020, + "fullAddress": "ca.orderer.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.orderer.example.com", + }, + "cryptoConfigFileName": "crypto-config-orderer", + "domain": "orderer.example.com", + "headPeer": undefined, + "mspName": "OrdererMSP", + "name": "Orderer", + "ordererGroups": [ + { + "configtxOrdererDefaults": "Group1Defaults", + "consensus": "BFT", + "genesisBlockName": "Group1Genesis.block", + "hostingOrgs": [ + "Orderer", + ], + "name": "group1", + "ordererHeads": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + ], + "orderers": [ + { + "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer0.group1.orderer.example.com:7030", + "name": "orderer0.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7030, + }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, + { + "address": "orderer2.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer2.group1.orderer.example.com:7032", + "name": "orderer2.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7032, + }, + { + "address": "orderer3.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "BFT", + "domain": "orderer.example.com", + "fullAddress": "orderer3.group1.orderer.example.com:7033", + "name": "orderer3.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7033, + }, + ], + "profileName": "Group1Genesis", + }, + ], + "peers": [], + "peersCount": 0, + "tools": {}, + }, + { + "anchorPeers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "ca": { + "address": "ca.org1.example.com", + "caAdminNameVar": "ORG1_CA_ADMIN_NAME", + "caAdminPassVar": "ORG1_CA_ADMIN_PASSWORD", + "db": "sqlite", + "exposePort": 7040, + "fullAddress": "ca.org1.example.com:7054", + "port": 7054, + "prefix": "ca", + }, + "cli": { + "address": "cli.org1.example.com", + }, + "cryptoConfigFileName": "crypto-config-org1", + "domain": "org1.example.com", + "headPeer": { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + "mspName": "Org1MSP", + "name": "Org1", + "ordererGroups": [], + "peers": [ + { + "address": "peer0.org1.example.com", + "couchDbExposePort": 5100, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer0.org1.example.com:7041", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer0", + "port": 7041, + }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "type": "LevelDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, + ], + "peersCount": 2, + "tools": {}, + }, + ], +} +`; + exports[`extend config samples/invalid-fablo-config.json 1`] = ` { "chaincodes": [ @@ -9025,6 +11158,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9036,6 +11170,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9048,6 +11183,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9061,6 +11197,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9342,6 +11479,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9353,6 +11491,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9365,6 +11504,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9378,6 +11518,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9510,6 +11651,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderedHeadsDistinct": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9530,6 +11672,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "group1", "ordererHead": { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9541,6 +11684,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9553,6 +11697,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9599,6 +11744,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "ordererHeads": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", @@ -9611,6 +11757,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orderers": [ { "address": "orderer0.group1.orderer.example.com", + "adminPort": 7053, "consensus": "etcdraft", "domain": "orderer.example.com", "fullAddress": "orderer0.group1.orderer.example.com:7030", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e86497d72..e13e09159 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1543,9 +1543,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 FABRIC_BASEOS_VERSION=2.3.3 -FABRIC_JAVAENV_VERSION=2.3 -FABRIC_NODEENV_VERSION=2.3 -RECOMMENDED_NODE_VERSION=12 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1715,6 +1718,7 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" @@ -1815,6 +1819,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -1823,6 +1828,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + } printStartSuccessInfo() { @@ -1927,22 +1933,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -2069,6 +2076,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2266,8 +2274,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -2281,7 +2289,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -2304,11 +2315,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -3065,7 +3076,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index b207f8f5d..dfc5ad03d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -117,6 +117,7 @@ Orderer: &Group1Defaults OrdererType: solo Addresses: - orderer0.group1.orderer.example.com:7030 + BatchTimeout: 2s BatchSize: MaxMessageCount: 10 @@ -1453,9 +1454,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 FABRIC_BASEOS_VERSION=2.5.9 -FABRIC_JAVAENV_VERSION=2.5 + + +FABRIC_JAVAENV_VERSION=3.0-beta FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=16 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1665,10 +1669,11 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" } @@ -1770,6 +1775,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -1778,6 +1784,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + } printStartSuccessInfo() { @@ -1881,11 +1888,14 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -1959,6 +1969,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2002,6 +2013,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2130,8 +2142,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -2145,7 +2157,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -2168,11 +2183,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -2929,7 +2944,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 33bc82dc4..9bc473251 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -168,6 +168,7 @@ Orderer: &Group1Defaults OrdererType: solo Addresses: - orderer0.group1.orderer.example.com:7030 + BatchTimeout: 2s BatchSize: MaxMessageCount: 10 @@ -2114,9 +2115,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 FABRIC_BASEOS_VERSION=2.4.7 -FABRIC_JAVAENV_VERSION=2.4 -FABRIC_NODEENV_VERSION=2.4 -RECOMMENDED_NODE_VERSION=16 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -2380,12 +2384,13 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoin 'my-channel1' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" } @@ -2563,6 +2568,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel1" "Org2MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -2574,6 +2580,7 @@ notifyOrgsAboutChannels() { printHeadline "Deleting new channel config blocks" "U1F52A" deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel1" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -2712,11 +2719,14 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -2793,6 +2803,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2836,6 +2847,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -2928,6 +2940,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -3056,8 +3069,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -3071,7 +3084,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -3094,11 +3110,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -3855,7 +3871,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 1f2d6803a..e203a90a9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -214,6 +214,7 @@ Orderer: &Group2Defaults OrdererType: solo Addresses: - orderer0.group2.orderer2.com:7050 + BatchTimeout: 2s BatchSize: MaxMessageCount: 1 @@ -3037,9 +3038,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 FABRIC_BASEOS_VERSION=2.4.3 -FABRIC_JAVAENV_VERSION=2.4 -FABRIC_NODEENV_VERSION=2.4 -RECOMMENDED_NODE_VERSION=16 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3494,24 +3498,25 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" - printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel1' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org2MSP' 'peer0.org2.example.com:7081' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" printHeadline "Creating 'my-channel2' on Org1/peer1" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel2' 'Org1MSP' 'peer1.org1.example.com:7062' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" - printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer1.org2.example.com:7082' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" printHeadline "Creating 'my-channel3' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer1.org1.example.com:7062' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer0.org2.example.com:7081' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" - printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer1.org2.example.com:7082' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer2.com-cert.pem' 'orderer0.group2.orderer2.com:7050';" } @@ -3683,6 +3688,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel1" "Org2MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -3706,6 +3712,7 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "my-channel2" "Org2MSP" "cli.org2.example.com" deleteNewChannelUpdateTx "my-channel3" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel3" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -3839,22 +3846,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3874,22 +3882,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -3909,22 +3918,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7032 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer1.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer1.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4002,22 +4012,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group2Genesis.block - ORDERER_GENERAL_LOCALMSPID=Orderer2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group2.orderer2.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group2Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group2.orderer2.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4126,6 +4137,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4174,6 +4186,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4282,6 +4295,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4330,6 +4344,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4463,8 +4478,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -4478,7 +4493,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -4501,11 +4519,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -5262,7 +5280,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index f6e7b7d26..91fed2897 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3333,9 +3333,12 @@ FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 FABRIC_BASEOS_VERSION=2.3.2 -FABRIC_JAVAENV_VERSION=2.3 -FABRIC_NODEENV_VERSION=2.3 -RECOMMENDED_NODE_VERSION=12 + + +FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=18 + ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3833,24 +3836,25 @@ generateChannelsArtifacts() { } installChannels() { + set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" printHeadline "Creating 'my-channel2' on Org2/peer0" "U1F63B" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel2' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel2' 'Org2MSP' 'peer1.org2.example.com:7062' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" printHeadline "Creating 'my-channel3' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org1/peer1" "U1F638" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer0" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer0.org2.example.com:7061' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" + printItalics "Joining 'my-channel3' on Org2/peer1" "U1F638" docker exec -i cli.org2.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel3' 'Org2MSP' 'peer1.org2.example.com:7062' 'crypto/users/Admin@org2.example.com/msp' 'crypto/users/Admin@org2.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" } @@ -3952,6 +3956,7 @@ upgradeChaincode() { } notifyOrgsAboutChannels() { + printHeadline "Creating new channel config blocks" "U1F537" createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" createNewChannelUpdateTx "my-channel2" "Org2MSP" "MyChannel2" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" @@ -3969,6 +3974,7 @@ notifyOrgsAboutChannels() { deleteNewChannelUpdateTx "my-channel2" "Org2MSP" "cli.org2.example.com" deleteNewChannelUpdateTx "my-channel3" "Org1MSP" "cli.org1.example.com" deleteNewChannelUpdateTx "my-channel3" "Org2MSP" "cli.org2.example.com" + } printStartSuccessInfo() { @@ -4089,22 +4095,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4124,22 +4131,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4221,22 +4229,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7050 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org1.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org1.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4256,22 +4265,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7051 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org1MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org1.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org1.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4300,6 +4310,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4346,6 +4357,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4446,22 +4458,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7070 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org2.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org2.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4481,22 +4494,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7071 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org2MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org2.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org2.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4525,6 +4539,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4571,6 +4586,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4671,22 +4687,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7090 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org3MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org3.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.org3.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4706,22 +4723,23 @@ services: - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_LISTENPORT=7091 - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - ORDERER_GENERAL_LOCALMSPID=Org3MSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - - GODEBUG=netdns=go - # metrics - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org3.example.com:9440 - - ORDERER_METRICS_PROVIDER=prometheus - # enabled TLS + # TLS Configuration - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.org3.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus working_dir: /var/hyperledger/orderer command: orderer ports: @@ -4750,6 +4768,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4796,6 +4815,7 @@ services: - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} # - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} @@ -4970,8 +4990,8 @@ createChannelTx() { docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME @@ -4985,7 +5005,10 @@ createNewChannelUpdateTx() { local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - local ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" @@ -5008,11 +5031,11 @@ createNewChannelUpdateTx() { docker exec -i $CONTAINER_NAME configtxgen \\ --configPath ./fabric-config \\ -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate ./config/"\${MSP_NAME}"anchors.tx \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ -channelID "\${CHANNEL_NAME}" \\ -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/"\${MSP_NAME}"anchors.tx "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME removeContainer $CONTAINER_NAME } @@ -5769,7 +5792,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "\${CHANNEL_NAME}".block diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 10cdeed92..eea3f4ea4 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -49,6 +50,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -59,6 +61,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -69,6 +72,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -81,6 +85,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -92,6 +97,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -113,6 +119,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -125,6 +132,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -136,6 +144,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -149,6 +158,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -159,6 +169,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -204,6 +215,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -214,6 +226,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -224,6 +237,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -236,6 +250,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -284,6 +299,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -296,6 +312,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -686,6 +703,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -696,6 +714,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -706,6 +725,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -718,6 +738,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -729,6 +750,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -740,6 +762,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1025,6 +1048,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1035,6 +1059,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -1045,6 +1070,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -1057,6 +1083,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1068,6 +1095,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1079,6 +1107,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1388,6 +1417,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1400,6 +1430,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1411,6 +1442,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" } @@ -1422,6 +1454,7 @@ Validation warnings count: 0 "orgMspName": "Orderer2MSP", "domain": "orderer2.com", "consensus": "solo", + "adminPort": 7053, "port": 7050, "fullAddress": "orderer0.group2.orderer2.com:7050" }, @@ -1726,6 +1759,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -1736,6 +1770,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -1746,6 +1781,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -1758,6 +1794,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1769,6 +1806,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -1780,6 +1818,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2166,6 +2205,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2176,6 +2216,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7031, "fullAddress": "orderer1.group1.orderer1.com:7031" }, @@ -2186,6 +2227,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7032, "fullAddress": "orderer2.group1.orderer1.com:7032" } @@ -2198,6 +2240,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -2209,6 +2252,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" } @@ -2220,6 +2264,7 @@ Validation warnings count: 0 "orgMspName": "Orderer1MSP", "domain": "orderer1.com", "consensus": "etcdraft", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer1.com:7030" }, @@ -2426,6 +2471,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", @@ -2472,6 +2518,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2484,6 +2531,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2495,6 +2543,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2508,6 +2557,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2553,6 +2603,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2565,6 +2616,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2771,6 +2823,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2783,6 +2836,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2794,6 +2848,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" } @@ -2805,6 +2860,7 @@ Validation warnings count: 0 "orgMspName": "OrdererMSP", "domain": "orderer.example.com", "consensus": "solo", + "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" }, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6923640c9..1613693ae 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -420,6 +420,7 @@ exports[`schema should match snapshot 1`] = ` "enum": [ "solo", "raft", + "BFT", ], "title": "Orderer type", "type": "string", diff --git a/samples/invalid-fablo-config.json b/samples/invalid-fablo-config.json index eefc9daef..32abdd3b2 100644 --- a/samples/invalid-fablo-config.json +++ b/samples/invalid-fablo-config.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", "global": { - "fabricVersion": "2.5.12", + "fabricVersion": "2.3.3", "tls": true, "tools": { "explorer": true From e2d7200776ee21e00bcb3a98cf9773d7b7a4fc40 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 12:52:04 +0530 Subject: [PATCH 265/471] changed the log check message in BFT test file Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05-version3-BFT.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index 179d2c531..2a236749b 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -51,7 +51,7 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT # start the network networkUp -waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" +waitForContainer "orderer0.group1.orderer.example.com" "Channel created" waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" From 5df5ac8cff036de3b3e9206306a2f4c4c8e935ed Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:57:30 +0530 Subject: [PATCH 266/471] Update src/setup-docker/index.ts Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Signed-off-by: Pereowei Daniel --- src/setup-docker/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 36711d822..18c064739 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -213,7 +213,7 @@ export default class SetupDockerGenerator extends Generator { } _copyUtilityScripts(capabilities: Capabilities): void { - this.fs.copyTpl(this.templatePath(`fabric-docker.sh`), this.destinationPath("fabric-docker.sh")); + this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), From d36b5b9368292e7ff26ea42f3e477acb47ec48cf Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 15:25:20 +0530 Subject: [PATCH 267/471] minor changes Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05-version3-BFT.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index 2a236749b..967b10a3d 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -52,6 +52,9 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT networkUp waitForContainer "orderer0.group1.orderer.example.com" "Channel created" +waitForContainer "orderer1.group1.orderer.example.com" "Channel created" +waitForContainer "orderer2.group1.orderer.example.com" "Channel created" +waitForContainer "orderer3.group1.orderer.example.com" "Channel created" waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" From 4e714f9bc89ab3dc5a0a5628b89ac6b7347df41c Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:23:46 +0530 Subject: [PATCH 268/471] Update e2e-network/docker/test-05-version3-BFT.sh Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05-version3-BFT.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh index 967b10a3d..42d3b5754 100755 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ b/e2e-network/docker/test-05-version3-BFT.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eux +set -eu TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" From b8ce2dc17416f0e62f33d2ef18ed80fe4d93e5b8 Mon Sep 17 00:00:00 2001 From: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:23:54 +0530 Subject: [PATCH 269/471] Update e2e-network/docker/test-05-version3.sh Co-authored-by: Jakub Dzikowski Signed-off-by: Sanket Teli <104385297+Sanket-0510@users.noreply.github.com> Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05-version3.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-network/docker/test-05-version3.sh b/e2e-network/docker/test-05-version3.sh index 94fa62801..5f08f5cf8 100755 --- a/e2e-network/docker/test-05-version3.sh +++ b/e2e-network/docker/test-05-version3.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -eux +set -eu TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" From 68b9aeb881f3f49cde4199d1ece669a66ccc0da6 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 16:26:19 +0530 Subject: [PATCH 270/471] minor fixes after the review Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/fabric-docker/.env | 8 ++---- .../fabric-docker/commands-generated.sh | 28 +++++++++---------- .../scripts/base-functions-v2.sh | 6 ---- .../scripts/cli/channel_fns-v2.sh | 9 ------ 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index 1fef13821..bfdc840c8 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -18,11 +18,9 @@ FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %> - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %> +FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %> +RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %> ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 15a12d994..d9c4b023f 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -48,8 +48,8 @@ installChannels() { <% channels.forEach((channel) => { -%> <% channel.ordererGroup.orderers.forEach((orderer) => { -%> <% const org = orgs.find((org) => org.name === orderer.orgName); -%> - docker exec -i <%= org.cli.address %> bash -c <% -%> - "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" + docker exec -i <%= org.cli.address %> bash -c <% -%> + "source scripts/channel_fns.sh; createChannelAndJoinTls '<%= channel.name %>' '<%= orderer.orgMspName %>' '<%= orderer.address %>:<%= orderer.adminPort %>' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.crt' 'crypto/users/Admin@<%= orderer.domain %>/tls/client.key' 'crypto-orderer/tlsca.<%= orderer.domain %>-cert.pem';" <% }) -%> <% if (channel.ordererGroup.consensus !== "BFT") { -%> sleep 4 # Wait for Raft cluster to establish consensus @@ -113,12 +113,12 @@ installChaincodes() { <% } else { -%> <% chaincodes.forEach((chaincode) => { -%> if [ -n "$(ls "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>")" ]; then - <% if (global.peerDevMode) { -%> - <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> - <% } else { -%> - local version="<%= chaincode.version %>" - <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> - <% } -%> + <% if (global.peerDevMode) { -%> + <%- include('commands-generated/chaincode-dev-v2.sh', { chaincode }); -%> + <% } else { -%> + local version="<%= chaincode.version %>" + <%- include('commands-generated/chaincode-install-v2.sh', { chaincode, global }); -%> + <% } -%> else echo "Warning! Skipping chaincode '<%= chaincode.name %>' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/<%= chaincode.directory %>'" @@ -199,22 +199,22 @@ notifyOrgsAboutChannels() { printHeadline "Notyfing orgs about channels" "U1F4E2" <% channels.forEach((channel) => { -%> <% channel.orgs.forEach((org) => { -%> - <% if(!global.tls) { -%> - notifyOrgAboutNewChannel <% -%> + <% if(!global.tls) { -%> + notifyOrgAboutNewChannel <% -%> "<%= channel.name %>" <% -%> "<%= org.mspName %>" <% -%> "<%= org.cli.address %>" <% -%> "peer0.<%= org.domain %>" <% -%> "<%= channel.ordererHead.fullAddress %>" - <% } else { -%> - notifyOrgAboutNewChannelTls <% -%> + <% } else { -%> + notifyOrgAboutNewChannelTls <% -%> "<%= channel.name %>" <% -%> "<%= org.mspName %>" <% -%> "<%= org.cli.address %>" <% -%> "peer0.<%= org.domain %>" <% -%> "<%= channel.ordererHead.fullAddress %>" <% -%> "crypto-orderer/tlsca.<%= channel.ordererHead.domain %>-cert.pem" - <% } -%> + <% } -%> <% }) -%> <% }) %> @@ -226,7 +226,7 @@ notifyOrgsAboutChannels() { <% }) -%> <% } else { %> - echo "" + echo "" <% } %> } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index b3aef4836..55f69fcfa 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -96,30 +96,24 @@ createChannelTx() { docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - removeContainer $CONTAINER_NAME } createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 local CONFIG_PATH=$4 local OUTPUT_PATH=$5 - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/${MSP_NAME}anchors-$CHANNEL_NAME.tx" OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/${MSP_NAME}anchors.tx" CONTAINER_COPY_PATH="${CONTAINER_NAME}:/config/${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." inputLog "CHANNEL_NAME: $CHANNEL_NAME" inputLog "MSP_NAME: $MSP_NAME" diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh index fad11a6fe..46da0021c 100755 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v2.sh @@ -4,11 +4,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -21,7 +19,6 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx peer channel join -b "${CHANNEL_NAME}".block @@ -31,7 +28,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -57,8 +53,6 @@ createChannelAndJoinTls() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . peer channel create -o "${ORDERER_URL}" -c "${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" @@ -70,11 +64,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -95,7 +87,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") From 1091ba0a80721281e3754e98b876042ec3207412 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Tue, 3 Dec 2024 16:31:51 +0530 Subject: [PATCH 271/471] updated the snapshots Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- ...rg-1chaincode-raft-explorer.json.test.ts.snap | 16 +++------------- ...config-hlf2-1org-1chaincode.json.test.ts.snap | 14 ++------------ ...gs-2chaincodes-private-data.yaml.test.ts.snap | 16 +++------------- ...hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 16 +++------------- ...gs-1chaincode-raft-explorer.json.test.ts.snap | 16 +++------------- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 -- 6 files changed, 14 insertions(+), 66 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index e13e09159..c5a9def06 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1544,11 +1544,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 FABRIC_BASEOS_VERSION=2.3.3 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.3 +FABRIC_NODEENV_VERSION=2.3 +RECOMMENDED_NODE_VERSION=12 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1718,7 +1716,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" @@ -2283,7 +2280,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -3058,11 +3054,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3084,7 +3078,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3120,11 +3113,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3145,7 +3136,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index dfc5ad03d..3037eeb28 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1455,11 +1455,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 FABRIC_BASEOS_VERSION=2.5.9 - -FABRIC_JAVAENV_VERSION=3.0-beta +FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -1669,7 +1667,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" @@ -2151,7 +2148,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -2926,11 +2922,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -2952,7 +2946,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -2988,11 +2981,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3013,7 +3004,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 9bc473251..d92769a50 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2116,11 +2116,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 FABRIC_BASEOS_VERSION=2.4.7 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.4 +FABRIC_NODEENV_VERSION=2.4 +RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -2384,7 +2382,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoin 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'orderer0.group1.orderer.example.com:7030';" @@ -3078,7 +3075,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -3853,11 +3849,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3879,7 +3873,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3915,11 +3908,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3940,7 +3931,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index e203a90a9..bfe6401d5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3039,11 +3039,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 FABRIC_BASEOS_VERSION=2.4.3 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.4 +FABRIC_NODEENV_VERSION=2.4 +RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3498,7 +3496,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7061' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer1.com-cert.pem' 'orderer0.group1.orderer1.com:7030';" @@ -4487,7 +4484,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -5262,11 +5258,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5288,7 +5282,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -5324,11 +5317,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5349,7 +5340,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 91fed2897..963c7b2fd 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3334,11 +3334,9 @@ FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 FABRIC_BASEOS_VERSION=2.3.2 - -FABRIC_JAVAENV_VERSION=3.0-beta -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=18 - +FABRIC_JAVAENV_VERSION=2.3 +FABRIC_NODEENV_VERSION=2.3 +RECOMMENDED_NODE_VERSION=12 ROOT_CA_ADMIN_NAME=admin ROOT_CA_ADMIN_PASSWORD=adminpw @@ -3836,7 +3834,6 @@ generateChannelsArtifacts() { } installChannels() { - set -x printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" @@ -4999,7 +4996,6 @@ createChannelTx() { createNewChannelUpdateTx() { local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 local MSP_NAME=$2 local CONFIG_PROFILE=$3 @@ -5774,11 +5770,9 @@ set -eu createChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5800,7 +5794,6 @@ createChannelAndJoin() { createChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -5836,11 +5829,9 @@ createChannelAndJoinTls() { fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -5861,7 +5852,6 @@ fetchChannelAndJoin() { fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index eea3f4ea4..6f3aa8aff 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,7 +2470,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From 30efd99071c8c1ef43f4422e8212ed205595841b Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 01:38:29 +0530 Subject: [PATCH 272/471] added the tests in the CI pipeline of fablo Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- .github/workflows/test-on-push.yml | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index f6eda5a0b..f786553fb 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -169,3 +169,55 @@ jobs: path: | e2e-network/docker/test-04-snapshot.sh.logs/* e2e-network/docker/test-04-snapshot.sh.tmpdir/fablo-target/**/* + + test-05-v3: + needs: test-main + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Build Fablo + run: | + shellcheck --version && \ + yamllint -v && \ + npm install && \ + ./fablo-build.sh + + - name: Test version 3 + run: e2e-network/docker/test-05-version3.sh + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-05-version3 + path: | + e2e-network/docker/test-05-version3-snapshot.sh.logs/* + e2e-network/docker/test-05-version3-snapshot.sh.tmpdir/fablo-target/**/* + + test-05-v3-BFT: + needs: test-main + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Build Fablo + run: | + shellcheck --version && \ + yamllint -v && \ + npm install && \ + ./fablo-build.sh + + - name: Test version 3 with BFT + run: e2e-network/docker/test-05-version3.sh + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test-05-version3-BFT-snapshot + path: | + e2e-network/docker/test-05-version3-BFT-snapshot.sh.logs/* + e2e-network/docker/test-05-version3-BFT-snapshot.sh.tmpdir/fablo-target/**/* + + From 7ac89a6dbb36f1f9d66cd92e49b7c19ee6b5bc75 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 01:47:51 +0530 Subject: [PATCH 273/471] updated testCases.md Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/TEST_CASES.md | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 80a71df03..f87022c66 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | -| TLS | no | yes | no | yes | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | -| Consensus | solo | RAFT | solo | RAFT | RAFT | -| Orderer nodes | 1 | 3 | 1 | 1 | 1 | -| Organizations | 1 | 2 | 2 | 1 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | -| Channels | 1 | 2 | 1 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | OR | -| Private data | no | no | yes | yes | no | -| Java chaincode | no | yes | no | no | no | -| Go chaincode | no | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | +| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:|:---------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | +| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | Postgres | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | CouchDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | +| Private data | no | no | yes | yes | no | no | +| Java chaincode | no | yes | no | no | no | no | +| Go chaincode | no | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | channel scripts | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | init, reset | From 58cf5e5af64709dc1bde8939ec50b2f008f5d36e Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 13:20:45 +0530 Subject: [PATCH 274/471] fixes in docker-compose Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- ...onfig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 4 +--- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 4 +--- ...nfig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 4 +--- ...fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 4 +--- ...nfig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 4 +--- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 -- 6 files changed, 5 insertions(+), 17 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index c5a9def06..daabe2219 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1863,9 +1863,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 3037eeb28..91009e8b4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1827,9 +1827,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index d92769a50..e39714890 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2655,9 +2655,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index bfe6401d5..47ea337c7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3771,9 +3771,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 963c7b2fd..9e0ed2686 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4017,9 +4017,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"version: '2.2' - -networks: +"networks: basic: services: diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index e26060fd3..9a3a8b8da 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '2.2' - networks: basic: From bd05269f9d82162ebcc5a8eb45563752e60c2ed8 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 17:44:10 +0530 Subject: [PATCH 275/471] some linting and other fixes Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/TEST_CASES.md | 8 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 3434 ++++++++++++++++ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 3459 +++++++++++++++++ e2e/__snapshots__/fabloCommands.test.ts.snap | 2 + ...-config-hlf3-1orgs-1chaincode.json.test.ts | 7 + ...fig-hlf3-bft-1orgs-1chaincode.json.test.ts | 7 + src/setup-docker/index.ts | 4 +- .../scripts/base-functions-v3.sh | 4 +- 8 files changed, 6917 insertions(+), 8 deletions(-) create mode 100644 e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap create mode 100644 e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap create mode 100644 e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts create mode 100644 e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index f87022c66..9e364a136 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -8,8 +8,8 @@ | Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | | Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | | Organizations | 1 | 2 | 2 | 1 | 1 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | Postgres | Postgres | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | CouchDB | CouchDB | +| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | | Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | | Channels | 1 | 2 | 1 | 1 | 1 | 1 | | Node chaincode | yes | yes | yes | yes | yes | yes | @@ -18,5 +18,5 @@ | Private data | no | no | yes | yes | no | no | | Java chaincode | no | yes | no | no | no | no | | Go chaincode | no | no | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | channel scripts | channel scripts | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | init, reset | init, reset | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap new file mode 100644 index 000000000..29e9fadad --- /dev/null +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -0,0 +1,3434 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V3_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - Host: orderer1.group1.orderer.example.com + Port: 7031 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - Host: orderer2.group1.orderer.example.com + Port: 7032 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - Host: orderer3.group1.orderer.example.com + Port: 7033 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 2 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"FABLO_VERSION=2.0.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=debug + +FABRIC_VERSION=3.0.0-beta +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta + +FABRIC_JAVAENV_VERSION=3.0 +FABRIC_NODEENV_VERSION=3.0 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + cli="" + peer_addresses="" + + peer_certs="" + + if [[ "$1" == *"peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer0.org1.example.com:7041" + + peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" + + fi + if [[ "$1" == *"peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + + peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + + fi + if [ -z "$peer_addresses" ]; then + echo "Unknown peers: $1" + exit 1 + fi + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" + +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + echo "-> Channel query: " + "$@" + + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + # Create directory for chaincode packages to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer0.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer1.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer2.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer3.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + sleep 4 # Wait for Raft cluster to establish consensus + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + echo "Running chaincode in dev mode is supported by Fablo only for V2 channel capabilities" + exit 1 +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + echo "" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \\ + --name $CONTAINER_NAME \\ + -v "$CONFIG_PATH":/fabric-config \\ + -v "$OUTPUT_PATH":/output \\ + hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.pb" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \\ + --channelID "\${CHANNEL_NAME}" \\ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \\ + -o "\${ORDERER_ADMIN_ADDRESS}" \\ + --client-cert "\${ADMIN_TLS_SIGN_CERT}" \\ + --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ + --ca-file "\${TLS_CA_CERT_PATH}" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com + orderer2.group1.orderer.example.com + orderer3.group1.orderer.example.com + peer0.org1.example.com + peer1.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + ca.org1.example.com + " +} + +__getCAPostgresNodes() { + echo " + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" +" +`; + +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap new file mode 100644 index 000000000..8794f0613 --- /dev/null +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -0,0 +1,3459 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V3_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: BFT + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 + ConsenterMapping: + - ID: 1 + Host: orderer0.group1.orderer.example.com + Port: 7030 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - ID: 2 + Host: orderer1.group1.orderer.example.com + Port: 7031 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - ID: 3 + Host: orderer2.group1.orderer.example.com + Port: 7032 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - ID: 4 + Host: orderer3.group1.orderer.example.com + Port: 7033 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com", + "peer1.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + - peer1.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 2 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"FABLO_VERSION=2.0.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=debug + +FABRIC_VERSION=3.0.0-beta +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta + +FABRIC_JAVAENV_VERSION=3.0 +FABRIC_NODEENV_VERSION=3.0 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + cli="" + peer_addresses="" + + peer_certs="" + + if [[ "$1" == *"peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer0.org1.example.com:7041" + + peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" + + fi + if [[ "$1" == *"peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + + peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + + fi + if [ -z "$peer_addresses" ]; then + echo "Unknown peers: $1" + exit 1 + fi + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + + peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" + +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + echo "-> Channel query: " + "$@" + + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + # Create directory for chaincode packages to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer0.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer1.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer2.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + docker exec -i cli.orderer.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'OrdererMSP' 'orderer3.group1.orderer.example.com:7053' 'crypto/users/Admin@orderer.example.com/tls/client.crt' 'crypto/users/Admin@orderer.example.com/tls/client.key' 'crypto-orderer/tlsca.orderer.example.com-cert.pem';" + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + echo "Running chaincode in dev mode is supported by Fablo only for V2 channel capabilities" + exit 1 +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + echo "" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run --rm \\ + --name $CONTAINER_NAME \\ + -v "$CONFIG_PATH":/fabric-config \\ + -v "$OUTPUT_PATH":/output \\ + hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" + + # shellcheck disable=SC2181 + if [ $? -ne 0 ]; then + echo "Failed to create channel configuration transaction." + exit 1 + fi + + echo "Channel configuration created at $CHANNEL_TX_PATH" + +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.pb" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.pb" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . + + osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local ORDERER_MSP_NAME=$2 + local ORDERER_ADMIN_ADDRESS=$3 + local ADMIN_TLS_SIGN_CERT=$(realpath "$4") + local ADMIN_TLS_PRIVATE_KEY=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$ORDERER_MSP_NAME + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " ORDERER_MSP_NAME: $ORDERER_MSP_NAME" + echo " ORDERER_ADMIN_ADDRESS: $ORDERER_ADMIN_ADDRESS" + echo " ADMIN_TLS_SIGN_CERT: $ADMIN_TLS_SIGN_CERT" + echo " ADMIN_TLS_PRIVATE_KEY: $ADMIN_TLS_PRIVATE_KEY" + echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" + + if [ ! -d "$DIR_NAME" ]; then + mkdir "$DIR_NAME" + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" + fi + + osnadmin channel join \\ + --channelID "\${CHANNEL_NAME}" \\ + --config-block "$DIR_NAME/$CHANNEL_NAME.pb" \\ + -o "\${ORDERER_ADMIN_ADDRESS}" \\ + --client-cert "\${ADMIN_TLS_SIGN_CERT}" \\ + --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ + --ca-file "\${TLS_CA_CERT_PATH}" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com + orderer2.group1.orderer.example.com + orderer3.group1.orderer.example.com + peer0.org1.example.com + peer1.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + ca.org1.example.com + " +} + +__getCAPostgresNodes() { + echo " + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" +" +`; + +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 6f3aa8aff..eea3f4ea4 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2470,6 +2471,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", diff --git a/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts b/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts new file mode 100644 index 000000000..e67e776d3 --- /dev/null +++ b/e2e/fablo-config-hlf3-1orgs-1chaincode.json.test.ts @@ -0,0 +1,7 @@ +import performTests from "./performTests"; + +const config = "samples/fablo-config-hlf3-1orgs-1chaincode.json"; + +describe(config, () => { + performTests(config); +}); diff --git a/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts b/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts new file mode 100644 index 000000000..ccd6d764a --- /dev/null +++ b/e2e/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts @@ -0,0 +1,7 @@ +import performTests from "./performTests"; + +const config = "samples/fablo-config-hlf3-bft-1orgs-1chaincode.json"; + +describe(config, () => { + performTests(config); +}); diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 18c064739..081ea4890 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -216,12 +216,12 @@ export default class SetupDockerGenerator extends Generator { this.fs.copyTpl(this.templatePath("fabric-docker.sh"), this.destinationPath("fabric-docker.sh")); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3? "v3": "v2"}.sh`), + this.templatePath(`fabric-docker/scripts/cli/channel_fns-${capabilities.isV3 ? "v3" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/cli/channel_fns.sh"), ); this.fs.copyTpl( - this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3? "v3": "v2"}.sh`), + this.templatePath(`fabric-docker/scripts/base-functions-${capabilities.isV3 ? "v3" : "v2"}.sh`), this.destinationPath("fabric-docker/scripts/base-functions.sh"), ); diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index 27f572e33..c3c2e1358 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -78,7 +78,6 @@ createChannelTx() { local CONFIG_PROFILE=$3 local OUTPUT_PATH=$4 local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME.pb" - echo CHNANEL_TX_PATH: $CHANNEL_TX_PATH echo "Creating channelTx for $CHANNEL_NAME..." inputLog "CONFIG_PATH: $CONFIG_PATH" @@ -98,7 +97,8 @@ createChannelTx() { -v "$OUTPUT_PATH":/output \ hyperledger/fabric-tools:"${FABRIC_VERSION}" \ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" - + + # shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "Failed to create channel configuration transaction." exit 1 From e77befe8b1f5492bdec12762eb6694c89cc2ffd8 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 17:52:23 +0530 Subject: [PATCH 276/471] updated the workflow file Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- .github/workflows/test-on-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index f786553fb..1f908cc7e 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -210,7 +210,7 @@ jobs: ./fablo-build.sh - name: Test version 3 with BFT - run: e2e-network/docker/test-05-version3.sh + run: e2e-network/docker/test-05-version3-BFT.sh - uses: actions/upload-artifact@v4 if: always() From 3f2f23a8ee7198a03dd5b1f402c18791b66ddcb2 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Thu, 5 Dec 2024 18:01:47 +0530 Subject: [PATCH 277/471] final fixes Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- samples/invalid-fablo-config.json | 67 ------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 samples/invalid-fablo-config.json diff --git a/samples/invalid-fablo-config.json b/samples/invalid-fablo-config.json deleted file mode 100644 index 32abdd3b2..000000000 --- a/samples/invalid-fablo-config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.2.0/schema.json", - "global": { - "fabricVersion": "2.3.3", - "tls": true, - "tools": { - "explorer": true - } - }, - "orgs": [ - { - "organization": { - "name": "some-org1", - "domain": "orderer.example.com", - "mspName": "some-org1" - }, - "orderers": [ - { - "groupName": "group1", - "type": "raft", - "instances": 1 - } - ] - }, - { - "organization": { - "name": "Org1", - "domain": "org1.example.com" - }, - "ca": { - "db": "postgres" - }, - "peer": { - "instances": 1, - "db": "CouchDb" - }, - "tools": { - "fabloRest": true - } - } - ], - "channels": [ - { - "name": "my-channel1", - "orgs": [ - { - "name": "Org1", - "peers": [ - "peer0" - ] - } - ] - } - ], - "chaincodes": [ - { - "name": "chaincode1", - "version": "0.0.1", - "lang": "node", - "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" - } - ], - "hooks": { - "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' \"./fablo-target/fabric-config/configtx.yaml\"" - } -} \ No newline at end of file From 27224b27f8a7b56872b8f8dc3b845302496b2cf7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:02:02 +0100 Subject: [PATCH 278/471] Update snapshot Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .gitignore | 1 + e2e/__snapshots__/fabloCommands.test.ts.snap | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ef408c5a0..4dd245410 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ fablo-target generators node_modules .idea +samples/invalid-fablo-config.json diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index eea3f4ea4..6f3aa8aff 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,7 +2470,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From b9814c80578fb253706041da53652dbda2f04092 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:25:07 +0100 Subject: [PATCH 279/471] Adjust versions Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 20 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 10 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 620 +----------------- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 + .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- ...ablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- src/extend-config/extendGlobal.ts | 6 +- 7 files changed, 38 insertions(+), 624 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 84c005f6b..e408624e7 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9800,13 +9800,13 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0-beta", + "fabricBaseosVersion": "3.0.0", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0-beta", - "fabricJavaenvVersion": "3.0", - "fabricNodeenvVersion": "3.0", + "fabricCcenvVersion": "3.0.0", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", }, @@ -10757,13 +10757,13 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0-beta", + "fabricBaseosVersion": "3.0.0", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0-beta", - "fabricJavaenvVersion": "3.0", - "fabricNodeenvVersion": "3.0", + "fabricCcenvVersion": "3.0.0", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", }, diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 29e9fadad..43c98acab 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1521,14 +1521,14 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0-beta +FABRIC_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0-beta -FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_CCENV_VERSION=3.0.0 +FABRIC_BASEOS_VERSION=3.0.0 -FABRIC_JAVAENV_VERSION=3.0 -FABRIC_NODEENV_VERSION=3.0 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 8794f0613..b471034a6 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1,5 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/.config/configstore/update-notifier-yo.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"{ + "optOut": false, + "lastUpdateCheck": 1733480539656 +}" +`; + exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -19,210 +26,7 @@ Capabilities: V2_5: true ################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - - - Host: peer1.org1.example.com - Port: 7042 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: BFT - Addresses: - - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 - - orderer2.group1.orderer.example.com:7032 - - orderer3.group1.orderer.example.com:7033 - - SmartBFT: - RequestBatchMaxCount: 100 - RequestBatchMaxInterval: 50ms - RequestForwardTimeout: 2s - RequestComplainTimeout: 20s - RequestAutoRemoveTimeout: 3m0s - ViewChangeResendInterval: 5s - ViewChangeTimeout: 20s - LeaderHeartbeatTimeout: 1m0s - CollectTimeout: 1s - RequestBatchMaxBytes: 10485760 - IncomingMessageBufferSize: 200 - RequestPoolSize: 100000 - LeaderHeartbeatCount: 10 - ConsenterMapping: - - ID: 1 - Host: orderer0.group1.orderer.example.com - Port: 7030 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - - ID: 2 - Host: orderer1.group1.orderer.example.com - Port: 7031 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt - - - ID: 3 - Host: orderer2.group1.orderer.example.com - Port: 7032 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt - - - ID: 4 - Host: orderer3.group1.orderer.example.com - Port: 7033 - MSPID: OrdererMSP - Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 10 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Consortium: SampleConsortium - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 +# CHANNEL " `; @@ -421,18 +225,7 @@ certificateAuthorities: `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - - Hostname: orderer1.group1 - - Hostname: orderer2.group1 - - Hostname: orderer3.group1 - Template: - Count: 0 - Users: - Count: 1 +" " `; @@ -1547,14 +1340,14 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0-beta +FABRIC_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0-beta -FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_CCENV_VERSION=3.0.0 +FABRIC_BASEOS_VERSION=3.0.0 -FABRIC_JAVAENV_VERSION=3.0 -FABRIC_NODEENV_VERSION=3.0 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 ROOT_CA_ADMIN_NAME=admin @@ -1917,390 +1710,7 @@ networkDown() { `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - orderer1.group1.orderer.example.com: - container_name: orderer1.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7031:7031 - - 8031:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - orderer2.group1.orderer.example.com: - container_name: orderer2.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7032 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7032:7032 - - 8032:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - orderer3.group1.orderer.example.com: - container_name: orderer3.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7033 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # V3 specific settings - - ORDERER_GENERAL_BOOTSTRAPMETHOD=none - - ORDERER_CHANNELPARTICIPATION_ENABLED=true - # Admin endpoint configuration - - ORDERER_ADMIN_TLS_ENABLED=true - - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7033:7033 - - 8033:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - peer1.org1.example.com: - container_name: peer1.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer1.org1.example.com - - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 - - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" - - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8042:9440 - - 7042:7042 - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic +" " `; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 6f3aa8aff..eea3f4ea4 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2470,6 +2471,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 467c2920e..e5bbf1b2d 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index 8f90718a6..d5548b633 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 9cd63d378..6059db4cc 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -22,13 +22,15 @@ const getVersions = (fabricVersion: string): FabricVersions => { "2.4.1": "2.4.2", }; + const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); + return { fabricVersion, fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", - fabricJavaenvVersion: majorMinor, - fabricNodeenvVersion: fabricNodeenvExceptions[fabricVersion] ?? majorMinor, + fabricJavaenvVersion: below3_0_0(majorMinor), + fabricNodeenvVersion: fabricNodeenvExceptions[fabricVersion] ?? below3_0_0(majorMinor), fabricRecommendedNodeVersion: version(fabricVersion).isGreaterOrEqual("2.4") ? "16" : "12", }; }; From 99499dc9faecd586dd3c78db352b790f70ea92c0 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:34:01 +0100 Subject: [PATCH 280/471] Update snapshots Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 610 +++++++++++++++++- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 - 2 files changed, 600 insertions(+), 12 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index b471034a6..8bf61889c 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1,12 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/.config/configstore/update-notifier-yo.json from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"{ - "optOut": false, - "lastUpdateCheck": 1733480539656 -}" -`; - exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -26,7 +19,210 @@ Capabilities: V2_5: true ################################################################################ -# CHANNEL +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + + - Host: peer1.org1.example.com + Port: 7042 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: BFT + Addresses: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 + + SmartBFT: + RequestBatchMaxCount: 100 + RequestBatchMaxInterval: 50ms + RequestForwardTimeout: 2s + RequestComplainTimeout: 20s + RequestAutoRemoveTimeout: 3m0s + ViewChangeResendInterval: 5s + ViewChangeTimeout: 20s + LeaderHeartbeatTimeout: 1m0s + CollectTimeout: 1s + RequestBatchMaxBytes: 10485760 + IncomingMessageBufferSize: 200 + RequestPoolSize: 100000 + LeaderHeartbeatCount: 10 + ConsenterMapping: + - ID: 1 + Host: orderer0.group1.orderer.example.com + Port: 7030 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/signcerts/orderer0.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + - ID: 2 + Host: orderer1.group1.orderer.example.com + Port: 7031 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/signcerts/orderer1.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + + - ID: 3 + Host: orderer2.group1.orderer.example.com + Port: 7032 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/signcerts/orderer2.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/server.crt + + - ID: 4 + Host: orderer3.group1.orderer.example.com + Port: 7033 + MSPID: OrdererMSP + Identity: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/signcerts/orderer3.group1.orderer.example.com-cert.pem + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 10 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Consortium: SampleConsortium + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 " `; @@ -225,7 +421,18 @@ certificateAuthorities: `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -" +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + - Hostname: orderer1.group1 + - Hostname: orderer2.group1 + - Hostname: orderer3.group1 + Template: + Count: 0 + Users: + Count: 1 " `; @@ -1710,7 +1917,390 @@ networkDown() { `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -" +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer2.group1.orderer.example.com: + container_name: orderer2.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7032 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer2.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7032:7032 + - 8032:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer2.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + orderer3.group1.orderer.example.com: + container_name: orderer3.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7033 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # V3 specific settings + - ORDERER_GENERAL_BOOTSTRAPMETHOD=none + - ORDERER_CHANNELPARTICIPATION_ENABLED=true + # Admin endpoint configuration + - ORDERER_ADMIN_TLS_ENABLED=true + - ORDERER_ADMIN_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_ADMIN_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_ADMIN_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_TLS_CLIENTROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + - ORDERER_ADMIN_LISTENADDRESS=0.0.0.0:7053 + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer3.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7033:7033 + - 8033:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer3.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic " `; diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index eea3f4ea4..6f3aa8aff 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,7 +2470,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From c032313e52281c871fdc91e8c28fdc21d97f872a Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 11:53:11 +0100 Subject: [PATCH 281/471] Add explicit fabricToolsVetsion Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 9 +++++++++ ...lf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 6 +++--- ...fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 6 +++--- ...f2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 8 ++++---- ...onfig-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 10 +++++----- ...f2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 10 +++++----- ...ablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 6 +++--- ...-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 6 +++--- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 ++ src/extend-config/extendGlobal.ts | 1 + src/setup-docker/templates/fabric-docker/.env | 2 +- .../templates/fabric-docker/docker-compose.yaml | 2 +- src/types/FabloConfigExtended.ts | 1 + 13 files changed, 41 insertions(+), 28 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index e408624e7..9aeff5dc8 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -594,6 +594,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.9", "fabricVersion": "2.5.9", "monitoring": { "loglevel": "info", @@ -1419,6 +1420,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.7", "fabricVersion": "2.4.7", "monitoring": { "loglevel": "info", @@ -2219,6 +2221,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.3", "fabricVersion": "2.3.3", "monitoring": { "loglevel": "info", @@ -3588,6 +3591,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.7", "fabricVersion": "2.4.7", "monitoring": { "loglevel": "info", @@ -5846,6 +5850,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] "fabricJavaenvVersion": "2.4", "fabricNodeenvVersion": "2.4", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.4.3", "fabricVersion": "2.4.3", "monitoring": { "loglevel": "debug", @@ -8435,6 +8440,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.2", "fabricVersion": "2.3.2", "monitoring": { "loglevel": "info", @@ -9806,6 +9812,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", @@ -10763,6 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", @@ -11629,6 +11637,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabricJavaenvVersion": "2.3", "fabricNodeenvVersion": "2.3", "fabricRecommendedNodeVersion": "12", + "fabricToolsVersion": "2.3.3", "fabricVersion": "2.3.3", "monitoring": { "loglevel": "info", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index daabe2219..eace9e6b3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1539,11 +1539,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.3.3 +FABRIC_TOOLS_VERSION=2.3.3 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.3 FABRIC_BASEOS_VERSION=2.3.3 - FABRIC_JAVAENV_VERSION=2.3 FABRIC_NODEENV_VERSION=2.3 RECOMMENDED_NODE_VERSION=12 @@ -1890,7 +1890,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2002,7 +2002,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 91009e8b4..2e511d2b0 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1450,11 +1450,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.5.9 +FABRIC_TOOLS_VERSION=2.5.9 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.5.9 FABRIC_BASEOS_VERSION=2.5.9 - FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1853,7 +1853,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -1924,7 +1924,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index e39714890..4aedb4494 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2111,11 +2111,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.4.7 +FABRIC_TOOLS_VERSION=2.4.7 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.7 FABRIC_BASEOS_VERSION=2.4.7 - FABRIC_JAVAENV_VERSION=2.4 FABRIC_NODEENV_VERSION=2.4 RECOMMENDED_NODE_VERSION=16 @@ -2681,7 +2681,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2755,7 +2755,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2892,7 +2892,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 47ea337c7..9835c648c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3034,11 +3034,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=2.4.3 +FABRIC_TOOLS_VERSION=2.4.3 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.4.3 FABRIC_BASEOS_VERSION=2.4.3 - FABRIC_JAVAENV_VERSION=2.4 FABRIC_NODEENV_VERSION=2.4 RECOMMENDED_NODE_VERSION=16 @@ -3798,7 +3798,7 @@ services: cli.orderer1.com: container_name: cli.orderer1.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -3964,7 +3964,7 @@ services: cli.orderer2.com: container_name: cli.orderer2.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4058,7 +4058,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4237,7 +4237,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 9e0ed2686..d2de3b306 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3329,11 +3329,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=info FABRIC_VERSION=2.3.2 +FABRIC_TOOLS_VERSION=2.3.2 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=2.3.2 FABRIC_BASEOS_VERSION=2.3.2 - FABRIC_JAVAENV_VERSION=2.3 FABRIC_NODEENV_VERSION=2.3 RECOMMENDED_NODE_VERSION=12 @@ -4044,7 +4044,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4177,7 +4177,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4406,7 +4406,7 @@ services: cli.org2.example.com: container_name: cli.org2.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -4635,7 +4635,7 @@ services: cli.org3.example.com: container_name: cli.org3.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 43c98acab..2e4a2b316 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1522,11 +1522,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 +FABRIC_TOOLS_VERSION=2.5 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 FABRIC_BASEOS_VERSION=3.0.0 - FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1919,7 +1919,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2145,7 +2145,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 8bf61889c..8783caddf 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1548,11 +1548,11 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 +FABRIC_TOOLS_VERSION=2.5 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 FABRIC_BASEOS_VERSION=3.0.0 - FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1944,7 +1944,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2170,7 +2170,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_VERSION} + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 6f3aa8aff..c769e0969 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -11,6 +11,7 @@ Validation warnings count: 0 "monitoring": { "loglevel": "debug" }, + "fabricToolsVersion": "2.4.3", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.4.3", "fabricBaseosVersion": "2.4.3", @@ -2476,6 +2477,7 @@ Validation warnings count: 0 "tls": false, "engine": "docker", "peerDevMode": false, + "fabricToolsVersion": "2.5.9", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.5.9", "fabricBaseosVersion": "2.5.9", diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 6059db4cc..62e51bc25 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -26,6 +26,7 @@ const getVersions = (fabricVersion: string): FabricVersions => { return { fabricVersion, + fabricToolsVersion: below3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", diff --git a/src/setup-docker/templates/fabric-docker/.env b/src/setup-docker/templates/fabric-docker/.env index bfdc840c8..9cdbdae4f 100755 --- a/src/setup-docker/templates/fabric-docker/.env +++ b/src/setup-docker/templates/fabric-docker/.env @@ -13,11 +13,11 @@ COMPOSE_PROJECT_NAME=<%= composeNetworkName %> LOGGING_LEVEL=<%= global.monitoring.loglevel %> FABRIC_VERSION=<%= global.fabricVersion %> +FABRIC_TOOLS_VERSION=<%= global.fabricToolsVersion %> FABRIC_CA_VERSION=<%= global.fabricCaVersion %> FABRIC_CA_POSTGRES_VERSION=<%= fabricCaPostgresVersion %> FABRIC_CCENV_VERSION=<%= global.fabricCcenvVersion %> FABRIC_BASEOS_VERSION=<%= global.fabricBaseosVersion %> - FABRIC_JAVAENV_VERSION=<%= global.fabricJavaenvVersion %> FABRIC_NODEENV_VERSION=<%= global.fabricNodeenvVersion %> RECOMMENDED_NODE_VERSION=<%= global.fabricRecommendedNodeVersion %> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9a3a8b8da..9b6232f6a 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -56,7 +56,7 @@ services: <%= org.cli.address %>: container_name: <%= org.cli.address %> - image: hyperledger/fabric-tools:${FABRIC_VERSION} + image: hyperledger/fabric-tools:${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 3a20c75d9..65de5bc14 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -1,5 +1,6 @@ export interface FabricVersions { fabricVersion: string; + fabricToolsVersion: string; fabricCaVersion: string; fabricCcenvVersion: string; fabricBaseosVersion: string; From 2c355dbcd2dfe1754e173fec72520c5bcffb8431 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 16:20:39 +0100 Subject: [PATCH 282/471] Update Docker commands to use FABRIC_TOOLS_VERSION instead of FABRIC_VERSION in multiple scripts and snapshot files Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 8 ++++---- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 8 ++++---- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 8 ++++---- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 8 ++++---- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 8 ++++---- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 8 ++++---- ...blo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 8 ++++---- .../templates/fabric-docker/scripts/base-functions-v2.sh | 8 ++++---- .../templates/fabric-docker/scripts/base-functions-v3.sh | 8 ++++---- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index eace9e6b3..015b868e3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2196,7 +2196,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2232,7 +2232,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2265,7 +2265,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2302,7 +2302,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 2e511d2b0..861c998ee 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2064,7 +2064,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2100,7 +2100,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2133,7 +2133,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2170,7 +2170,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 4aedb4494..ee1ecb951 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2991,7 +2991,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -3027,7 +3027,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -3060,7 +3060,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -3097,7 +3097,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 9835c648c..b21da4d61 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4400,7 +4400,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -4436,7 +4436,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4469,7 +4469,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4506,7 +4506,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index d2de3b306..eea88db84 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4912,7 +4912,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -4948,7 +4948,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -4981,7 +4981,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -5018,7 +5018,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 2e4a2b316..ac949748f 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -2304,7 +2304,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2340,7 +2340,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2377,7 +2377,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2416,7 +2416,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 8783caddf..e30772692 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -2329,7 +2329,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2365,7 +2365,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2402,7 +2402,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_VERSION}" \\ + hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2441,7 +2441,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 55f69fcfa..fc2f02f67 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -91,7 +91,7 @@ createChannelTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -128,7 +128,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index c3c2e1358..da91a34be 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -95,7 +95,7 @@ createChannelTx() { --name $CONTAINER_NAME \ -v "$CONFIG_PATH":/fabric-config \ -v "$OUTPUT_PATH":/output \ - hyperledger/fabric-tools:"${FABRIC_VERSION}" \ + hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -136,7 +136,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME From 99c3ce85a0c27c9002c73ddf34bb7f841f4d778d Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 16:47:30 +0100 Subject: [PATCH 283/471] Update fabricToolsVersion to 3.0.0-beta in configuration snapshots and extendGlobal logic Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 4 ++-- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- .../fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 ++ src/extend-config/extendGlobal.ts | 4 +++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 9aeff5dc8..824efa1cd 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9812,7 +9812,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "2.5", + "fabricToolsVersion": "3.0.0-beta", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", @@ -10770,7 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "2.5", + "fabricToolsVersion": "3.0.0-beta", "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index ac949748f..d821017c6 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1522,7 +1522,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 -FABRIC_TOOLS_VERSION=2.5 +FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index e30772692..546232b25 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1548,7 +1548,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0 -FABRIC_TOOLS_VERSION=2.5 +FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index c769e0969..280c9d90d 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,7 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2471,6 +2472,7 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 62e51bc25..0bd8abda3 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -24,9 +24,11 @@ const getVersions = (fabricVersion: string): FabricVersions => { const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); + const beta3_0_0 = (v: string) => (v.startsWith("3.0.") ? "3.0.0-beta" : v); + return { fabricVersion, - fabricToolsVersion: below3_0_0(fabricVersion), + fabricToolsVersion: beta3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", From 2662b845fefa9a3413f1d5d0562fa5027e485584 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 6 Dec 2024 16:56:54 +0100 Subject: [PATCH 284/471] Update snapshots Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 -- 1 file changed, 2 deletions(-) diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 280c9d90d..c769e0969 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,7 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.4.3", @@ -2472,7 +2471,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Could not check for updates. Url: 'https://api.github.com/repos/hyperledger-labs/fablo/releases' not available { "global": { "fabricVersion": "2.5.9", From e291799a9792b4126e431b848224a6a55c523de1 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 11:01:35 +0100 Subject: [PATCH 285/471] Validation changes to make explicit Fablo supports Fabric up to 3.0.0-beta Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 12 ++--- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 45 +++++++++++++++++-- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 6 +-- .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- ...ablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- src/repositoryUtils.test.ts | 4 ++ src/validate/index.ts | 21 +++++++++ 7 files changed, 78 insertions(+), 14 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 824efa1cd..0473ec547 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9806,14 +9806,14 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0", + "fabricBaseosVersion": "3.0.0-beta", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0", + "fabricCcenvVersion": "3.0.0-beta", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", "fabricToolsVersion": "3.0.0-beta", - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "monitoring": { "loglevel": "debug", }, @@ -10764,14 +10764,14 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0", + "fabricBaseosVersion": "3.0.0-beta", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0", + "fabricCcenvVersion": "3.0.0-beta", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", "fabricToolsVersion": "3.0.0-beta", - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "monitoring": { "loglevel": "debug", }, diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index d821017c6..4391df33f 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1,5 +1,43 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"0 verbose cli /usr/local/bin/node /usr/local/bin/npm +1 info using npm@9.5.1 +2 info using node@v18.16.0 +3 timing npm:load:whichnode Completed in 6ms +4 timing config:load:defaults Completed in 1ms +5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms +6 timing config:load:builtin Completed in 1ms +7 timing config:load:cli Completed in 2ms +8 timing config:load:env Completed in 0ms +9 timing config:load:project Completed in 7ms +10 timing config:load:file:/network/workspace/.npmrc Completed in 2ms +11 timing config:load:user Completed in 2ms +12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms +13 timing config:load:global Completed in 0ms +14 timing config:load:setEnvs Completed in 0ms +15 timing config:load Completed in 15ms +16 timing npm:load:configload Completed in 15ms +17 timing npm:load:mkdirpcache Completed in 8ms +18 timing npm:load:mkdirplogs Completed in 12ms +19 verbose title npm root +20 verbose argv "root" "--global" +21 timing npm:load:setTitle Completed in 2ms +22 timing config:load:flatten Completed in 2ms +23 timing npm:load:display Completed in 3ms +24 verbose logfile logs-max:10 dir:/network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z- +25 verbose logfile /network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log +26 timing npm:load:logFile Completed in 68ms +27 timing npm:load:timers Completed in 0ms +28 timing npm:load:configScope Completed in 0ms +29 timing npm:load Completed in 118ms +30 timing command:root Completed in 5ms +31 verbose exit 0 +32 timing npm Completed in 140ms +33 info ok +" +`; + exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -1521,12 +1559,12 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0 +FABRIC_VERSION=3.0.0-beta FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0 -FABRIC_BASEOS_VERSION=3.0.0 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -3406,6 +3444,7 @@ echo "Executing post-generate hook" exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 546232b25..ca807e361 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1547,12 +1547,12 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0 +FABRIC_VERSION=3.0.0-beta FABRIC_TOOLS_VERSION=3.0.0-beta FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0 -FABRIC_BASEOS_VERSION=3.0.0 +FABRIC_CCENV_VERSION=3.0.0-beta +FABRIC_BASEOS_VERSION=3.0.0-beta FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index e5bbf1b2d..467c2920e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index d5548b633..8f90718a6 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", "global": { - "fabricVersion": "3.0.0", + "fabricVersion": "3.0.0-beta", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index b50b6455f..bbd7ba2f8 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -19,5 +19,9 @@ describe("repositoryUtils", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); expect(version("1.4.0").isGreaterOrEqual("1.3.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("2.1.0")).toBe(false); + expect(version("3.0.0").isGreaterOrEqual("3.0.0-beta")).toBe(true); + expect(version("3.0.0-beta").isGreaterOrEqual("3.0.0")).toBe(true); + expect(version("3.0.0").isGreaterOrEqual("3.0.0")).toBe(true); + expect(version("3.0.0").isGreaterOrEqual("3.0.1")).toBe(false); }); }); diff --git a/src/validate/index.ts b/src/validate/index.ts index 3d8a3b883..fd7044f53 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -90,6 +90,7 @@ class ValidateGenerator extends Generator { this._validateIfConfigFileExists(this.options.fabloConfig); const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); + this._validateFabricVersion(networkConfig.global); this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); @@ -122,6 +123,26 @@ class ValidateGenerator extends Generator { this._verifyFabricVersion(networkConfig.global); } + private _validateFabricVersion(global: GlobalJson) { + // 1. we support fabric up to 3.0.0-beta + if (version(global.fabricVersion).isGreaterOrEqual("3.0.0") && global.fabricVersion !== "3.0.0-beta") { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric up to 3.0.0-beta.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + + // 2. we support Fabric starting from 2.0.0 + if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric starting from 2.0.0.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } + async shortSummary() { console.log(`Validation errors count: ${this.errors.count()}`); console.log(`Validation warnings count: ${this.warnings.count()}`); From 0ca096aa947c49ebaeba13fce9dd9212e4aae72c Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 11:01:45 +0100 Subject: [PATCH 286/471] Update CHANGELOG Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b56ebbf..5c00d166a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.1.0 + +### Features +* Support Fabric 3.0.0-beta, along with BFT consensus + [#501](https://github.com/hyperledger-labs/fablo/pull/501) + ## 2.0.0 ### Breaking changes From cf04d9bd8bbea4d2bed028f8933ee07d1a261039 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 11:16:56 +0100 Subject: [PATCH 287/471] Update snapshots Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 4391df33f..800134ea0 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1,43 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"0 verbose cli /usr/local/bin/node /usr/local/bin/npm -1 info using npm@9.5.1 -2 info using node@v18.16.0 -3 timing npm:load:whichnode Completed in 6ms -4 timing config:load:defaults Completed in 1ms -5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms -6 timing config:load:builtin Completed in 1ms -7 timing config:load:cli Completed in 2ms -8 timing config:load:env Completed in 0ms -9 timing config:load:project Completed in 7ms -10 timing config:load:file:/network/workspace/.npmrc Completed in 2ms -11 timing config:load:user Completed in 2ms -12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms -13 timing config:load:global Completed in 0ms -14 timing config:load:setEnvs Completed in 0ms -15 timing config:load Completed in 15ms -16 timing npm:load:configload Completed in 15ms -17 timing npm:load:mkdirpcache Completed in 8ms -18 timing npm:load:mkdirplogs Completed in 12ms -19 verbose title npm root -20 verbose argv "root" "--global" -21 timing npm:load:setTitle Completed in 2ms -22 timing config:load:flatten Completed in 2ms -23 timing npm:load:display Completed in 3ms -24 verbose logfile logs-max:10 dir:/network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z- -25 verbose logfile /network/workspace/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log -26 timing npm:load:logFile Completed in 68ms -27 timing npm:load:timers Completed in 0ms -28 timing npm:load:configScope Completed in 0ms -29 timing npm:load Completed in 118ms -30 timing command:root Completed in 5ms -31 verbose exit 0 -32 timing npm Completed in 140ms -33 info ok -" -`; - exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "/config /crypto-config @@ -3444,7 +3406,6 @@ echo "Executing post-generate hook" exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ - "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/.npm/_logs/2024-12-07T09_57_41_821Z-debug-0.log", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/configtx.yaml", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", From 4c4cfba2da390f672c95de275787c410aef3c694 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Sat, 7 Dec 2024 12:42:46 +0100 Subject: [PATCH 288/471] Create directory to avoid permission errors Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...org-1chaincode-raft-explorer.json.test.ts.snap | 3 ++- ...-config-hlf2-1org-1chaincode.json.test.ts.snap | 3 ++- ...rgs-2chaincodes-private-data.yaml.test.ts.snap | 3 ++- ...-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 3 ++- ...rgs-1chaincode-raft-explorer.json.test.ts.snap | 3 ++- ...config-hlf3-1orgs-1chaincode.json.test.ts.snap | 15 +++++++-------- ...ig-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 15 +++++++-------- .../templates/fabric-docker/commands-generated.sh | 3 ++- .../fabric-docker/scripts/cli/channel_fns-v3.sh | 13 +++++-------- 9 files changed, 31 insertions(+), 30 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 015b868e3..21b4d6417 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1700,8 +1700,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 861c998ee..4e9b88f95 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,8 +1651,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index ee1ecb951..f6cf5a4f6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2366,8 +2366,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index b21da4d61..48ec32465 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3476,8 +3476,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group2" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group2Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index eea88db84..7069bba2e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3814,8 +3814,9 @@ generateArtifacts() { printItalics "Generating genesis block for group group1" "U1F3E0" genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 800134ea0..014e80feb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1730,8 +1730,9 @@ generateArtifacts() { printItalics "Generating crypto material for Org1" "U1F512" certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -3186,7 +3187,7 @@ createChannelAndJoin() { cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } createChannelAndJoinTls() { @@ -3207,7 +3208,7 @@ createChannelAndJoinTls() { echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" if [ ! -d "$DIR_NAME" ]; then - mkdir "$DIR_NAME" + mkdir -p "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" fi @@ -3219,16 +3220,15 @@ createChannelAndJoinTls() { --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ --ca-file "\${TLS_CA_CERT_PATH}" + cd .. rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3244,12 +3244,11 @@ fetchChannelAndJoin() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" peer channel join -b "\${CHANNEL_NAME}"_newest.block - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3278,7 +3277,7 @@ fetchChannelAndJoinTls() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } " `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index ca807e361..1509993f8 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1756,8 +1756,9 @@ generateArtifacts() { printItalics "Generating crypto material for Org1" "U1F512" certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { @@ -3211,7 +3212,7 @@ createChannelAndJoin() { cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } createChannelAndJoinTls() { @@ -3232,7 +3233,7 @@ createChannelAndJoinTls() { echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" if [ ! -d "$DIR_NAME" ]; then - mkdir "$DIR_NAME" + mkdir -p "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" fi @@ -3244,16 +3245,15 @@ createChannelAndJoinTls() { --client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\ --ca-file "\${TLS_CA_CERT_PATH}" + cd .. rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -3269,12 +3269,11 @@ fetchChannelAndJoin() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" peer channel join -b "\${CHANNEL_NAME}"_newest.block - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -3303,7 +3302,7 @@ fetchChannelAndJoinTls() { peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } " `; diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index d9c4b023f..b22588f21 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -20,8 +20,9 @@ generateArtifacts() { <% } %> <%_ }) _%> - # Create directory for chaincode packages to avoid permission errors on linux + # Create directories to avoid permission errors on linux mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" } startNetwork() { diff --git a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh index 1b51468aa..247e26e10 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh @@ -21,11 +21,10 @@ createChannelAndJoin() { mkdir "$DIR_NAME" && cd "$DIR_NAME" - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb . osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } createChannelAndJoinTls() { @@ -46,7 +45,7 @@ createChannelAndJoinTls() { echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH" if [ ! -d "$DIR_NAME" ]; then - mkdir "$DIR_NAME" + mkdir -p "$DIR_NAME" cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME" fi @@ -58,16 +57,15 @@ createChannelAndJoinTls() { --client-key "${ADMIN_TLS_PRIVATE_KEY}" \ --ca-file "${TLS_CA_CERT_PATH}" + cd .. rm -rf "$DIR_NAME" } fetchChannelAndJoin() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS @@ -83,12 +81,11 @@ fetchChannelAndJoin() { peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" peer channel join -b "${CHANNEL_NAME}"_newest.block - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } fetchChannelAndJoinTls() { local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 local CORE_PEER_ADDRESS=$3 local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") @@ -117,5 +114,5 @@ fetchChannelAndJoinTls() { peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - rm -rf "$DIR_NAME" + cd .. && rm -rf "$DIR_NAME" } From 98e9275d0546690d0ad02961b823bf99baf249b7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Wed, 8 Jan 2025 12:11:44 +0100 Subject: [PATCH 289/471] Set version 2.1.0 Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- README.md | 8 ++++---- bump-version.sh | 4 ++-- docs/sample.json | 2 +- docs/schema.json | 2 +- ...ablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap | 2 +- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- ...blo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 +++--- e2e/__snapshots__/schema.test.ts.snap | 2 +- fablo.sh | 2 +- package-lock.json | 4 ++-- package.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-k8s.json | 2 +- .../fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode.json | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml | 2 +- samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml | 2 +- .../fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- samples/fablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- 25 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 95ebe9799..af23e7b5e 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ You may keep the script in the root directory of your project or install it glob To install it globally: ```bash -sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo +sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo ``` To get a copy of Fablo for a single project, execute in the project root: ```bash -curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/fablo.sh -o ./fablo && chmod +x ./fablo +curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o ./fablo && chmod +x ./fablo ``` ## Getting started @@ -344,7 +344,7 @@ The basic structure of Fablo config file is as follows: ```json { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { ... }, "orgs": [ ... ], "channels": [ ... ], @@ -507,7 +507,7 @@ Genrated Hooks are saved in `fablo-target/hooks`. ```yaml --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json global: fabricVersion: 2.4.2 tls: false diff --git a/bump-version.sh b/bump-version.sh index e185c675b..8d3ca5e5f 100755 --- a/bump-version.sh +++ b/bump-version.sh @@ -7,9 +7,9 @@ include_readme=true ver_arg="${1:-unstable}" if [ "$ver_arg" = "patch" ] || [ "$ver_arg" = "minor" ] || [ "$ver_arg" = "major" ]; then - new_version=$(semver "$old_version" -i "$ver_arg") + new_version=$(semver next "$ver_arg" "$old_version") elif [ "$ver_arg" = "unstable" ]; then - new_version=$(semver "$old_version" -i prerelease --preid unstable) + new_version="$(semver next patch "$old_version")-unstable" include_readme=false elif [ "$ver_arg" = "set" ]; then new_version="$2" diff --git a/docs/sample.json b/docs/sample.json index 360bec3d8..98635be5a 100644 --- a/docs/sample.json +++ b/docs/sample.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": false, diff --git a/docs/schema.json b/docs/schema.json index 2f411465c..5959b4eae 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -12,7 +12,7 @@ ], "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json" + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json" }, "global": { "$id": "#/properties/global", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 94939945c..d0652318e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -86,7 +86,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper REPOSITORY="https://kfsoftware.github.io/hlf-helm-charts" STORAGE_CLASS=$(kubectl describe sc | grep Name | tr -s ' ' | cut -d ':' -f 2 | cut -d ' ' -f 2) -FABLO_VERSION=2.0.0 +FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_CONFIG= ORDERER_IMAGE=hyperledger/fabric-orderer diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 21b4d6417..1d6eadd1a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1524,7 +1524,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 4e9b88f95..27cf0a253 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1435,7 +1435,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index f6cf5a4f6..f241869fa 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2096,7 +2096,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 48ec32465..3e152f3c7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3019,7 +3019,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 7069bba2e..978b75863 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3314,7 +3314,7 @@ fi `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 014e80feb..383677e96 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1507,7 +1507,7 @@ fi `; exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 1509993f8..40a05191a 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1533,7 +1533,7 @@ fi `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.0.0 +"FABLO_VERSION=2.1.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index c769e0969..74c92c453 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2965,7 +2965,7 @@ Validation warnings count: 0 exports[`init should init simple fablo config 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3019,7 +3019,7 @@ exports[`init should init simple fablo config 1`] = ` exports[`init should init simple fablo config with node chaincode 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3081,7 +3081,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` exports[`init should init simple fablo config with node chaincode and rest api 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 1613693ae..c93059f0d 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -7,7 +7,7 @@ exports[`schema should match snapshot 1`] = ` "default": {}, "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", }, "chaincodes": { "$id": "#/properties/chaincodes", diff --git a/fablo.sh b/fablo.sh index ac6dbaeaa..92b2e0eae 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,7 +2,7 @@ set -e -FABLO_VERSION=1.2.1-unstable.0 +FABLO_VERSION=2.1.0 FABLO_IMAGE_NAME="ghcr.io/fablo-io/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" diff --git a/package-lock.json b/package-lock.json index 8ec5e9e25..ec4e79c73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generator-fablo", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "generator-fablo", - "version": "2.0.0", + "version": "2.1.0", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index b3f81f51d..07e644d5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-fablo", - "version": "2.0.0", + "version": "2.1.0", "description": "Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.", "author": "Piotr Hejwowski , Jakub Dzikowski ", "repository": { diff --git a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json index 62ef917d6..629ba983e 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.4.7", "tls": false, diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 176cb5a0f..fd7196f06 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.3.3", "tls": true, diff --git a/samples/fablo-config-hlf2-1org-1chaincode.json b/samples/fablo-config-hlf2-1org-1chaincode.json index 4053ad5a0..fb890fff2 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml index c71fef021..4a31f8f39 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json global: fabricVersion: 2.4.7 tls: false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml index 2fdb0d9cb..c3a944074 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json global: fabricVersion: 2.4.3 tls: true diff --git a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json index e1686dbfe..91e0e3f6e 100644 --- a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": true, diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index 467c2920e..b7a78431c 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index 8f90718a6..a35c76f07 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.0.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, From a44ebbe2840d3b1602afcd70ff97c18255c1cfb7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Wed, 8 Jan 2025 12:12:08 +0100 Subject: [PATCH 290/471] Add VSC config to gitignore Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4dd245410..25d70bd35 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ fablo-target generators node_modules .idea +.vscode samples/invalid-fablo-config.json From 787b2bb4c8ed4ffa2623f04b5568f58502bd6e32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:31:45 +0000 Subject: [PATCH 291/471] Bump cross-spawn from 7.0.3 to 7.0.6 Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6. - [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md) - [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6) --- updated-dependencies: - dependency-name: cross-spawn dependency-type: indirect ... Signed-off-by: dependabot[bot] Signed-off-by: Pereowei Daniel --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec4e79c73..84363f847 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4145,9 +4145,9 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -17621,9 +17621,9 @@ "dev": true }, "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "requires": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", From e0dba1447b3c0aa61d4a8f3ab8c86c677d2b03d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:53:12 +0000 Subject: [PATCH 292/471] Bump ejs and ejs-lint Bumps [ejs](https://github.com/mde/ejs) to 3.1.10 and updates ancestor dependency [ejs-lint](https://github.com/ryanzim/ejs-lint). These dependencies need to be updated together. Updates `ejs` from 3.1.7 to 3.1.10 - [Release notes](https://github.com/mde/ejs/releases) - [Commits](https://github.com/mde/ejs/compare/v3.1.7...v3.1.10) Updates `ejs-lint` from 1.2.2 to 2.0.1 - [Release notes](https://github.com/ryanzim/ejs-lint/releases) - [Commits](https://github.com/ryanzim/ejs-lint/compare/v1.2.2...2.0.1) --- updated-dependencies: - dependency-name: ejs dependency-type: indirect - dependency-name: ejs-lint dependency-type: direct:development ... Signed-off-by: dependabot[bot] Signed-off-by: Pereowei Daniel --- package-lock.json | 212 +++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 183 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 84363f847..4c7923383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "copyfiles": "2.4.1", - "ejs-lint": "^1.2.0", + "ejs-lint": "^2.0.1", "eslint": "^7.24.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.2.0", @@ -4676,37 +4676,127 @@ "dev": true }, "node_modules/ejs-lint": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-1.2.2.tgz", - "integrity": "sha512-ESR/MePvJJJfkK3EUAYlPKe2JM2nRDc4uFkGgbB5Prr06nluN7JozNVFL3Ze7LV7xNY7JPWEi5H3i4hOl6mxXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.1.tgz", + "integrity": "sha512-GrH+UuYaOlhS/cnCJEY5EANnFvWe6zyf0h6uOAKG2/EiG2Ch9S8vnX3CwAMP9Q1xlCagPNzwRDJG8MVCV4IJLg==", "dev": true, "dependencies": { - "chalk": "^4.0.0", - "ejs": "3.1.7", + "chalk": "^5.0.0", + "ejs": "3.1.10", "ejs-include-regex": "^1.0.0", - "globby": "^11.0.0", + "globby": "^13.0.0", "read-input": "^0.3.1", - "slash": "^3.0.0", + "slash": "^5.0.0", "syntax-error": "^1.1.6", - "yargs": "^16.0.0" + "yargs": "^17.0.0" }, "bin": { "ejslint": "cli.js" } }, - "node_modules/ejs-lint/node_modules/ejs": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", + "node_modules/ejs-lint/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ejs-lint/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { - "jake": "^10.8.5" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" }, - "bin": { - "ejs": "bin/cli.js" + "engines": { + "node": ">=12" + } + }, + "node_modules/ejs-lint/node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/globby/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ejs-lint/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ejs-lint/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/ejs-lint/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" } }, "node_modules/electron-to-chromium": { @@ -17996,29 +18086,91 @@ "dev": true }, "ejs-lint": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-1.2.2.tgz", - "integrity": "sha512-ESR/MePvJJJfkK3EUAYlPKe2JM2nRDc4uFkGgbB5Prr06nluN7JozNVFL3Ze7LV7xNY7JPWEi5H3i4hOl6mxXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ejs-lint/-/ejs-lint-2.0.1.tgz", + "integrity": "sha512-GrH+UuYaOlhS/cnCJEY5EANnFvWe6zyf0h6uOAKG2/EiG2Ch9S8vnX3CwAMP9Q1xlCagPNzwRDJG8MVCV4IJLg==", "dev": true, "requires": { - "chalk": "^4.0.0", - "ejs": "3.1.7", + "chalk": "^5.0.0", + "ejs": "3.1.10", "ejs-include-regex": "^1.0.0", - "globby": "^11.0.0", + "globby": "^13.0.0", "read-input": "^0.3.1", - "slash": "^3.0.0", + "slash": "^5.0.0", "syntax-error": "^1.1.6", - "yargs": "^16.0.0" + "yargs": "^17.0.0" }, "dependencies": { - "ejs": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", + "chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", "dev": true, "requires": { - "jake": "^10.8.5" + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "dependencies": { + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + } } + }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, + "slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true } } }, diff --git a/package.json b/package.json index 07e644d5a..4a88d1ebf 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/parser": "^4.22.0", "copyfiles": "2.4.1", - "ejs-lint": "^1.2.0", + "ejs-lint": "^2.0.1", "eslint": "^7.24.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.2.0", From c0483baf87ee71277422f5a7d5d6b43177d5fed6 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Wed, 8 Jan 2025 12:13:19 +0100 Subject: [PATCH 293/471] NPM audit fix Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- package-lock.json | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c7923383..42ab6c18c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8845,9 +8845,9 @@ "devOptional": true }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -8855,6 +8855,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -9947,10 +9948,11 @@ } }, "node_modules/path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", + "integrity": "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==", "dev": true, + "license": "MIT", "dependencies": { "isarray": "0.0.1" } @@ -21266,9 +21268,9 @@ "devOptional": true }, "nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true }, "natural-compare": { @@ -22110,9 +22112,9 @@ } }, "path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", + "integrity": "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==", "dev": true, "requires": { "isarray": "0.0.1" From 98550dbb57d237b7786b7bd2234694ea01d08c09 Mon Sep 17 00:00:00 2001 From: SRshohan Date: Fri, 7 Feb 2025 02:36:57 -0500 Subject: [PATCH 294/471] Added Signed-off-by: SRshohan Signed-off-by: Pereowei Daniel --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af23e7b5e..63b6a659d 100644 --- a/README.md +++ b/README.md @@ -213,12 +213,12 @@ Chaincode directory is specified in Fablo config file. Invokes chaincode with specified parameters. ``` -fablo chaincode invoke [transient] +fablo chaincode invoke [transient] ``` Sample command: ``` -fablo chaincode invoke "my-channel1" "chaincode1" "peer0.org1.example.com" '{"Args":["KVContract:put", "name", "Willy Wonka"]}' +fablo chaincode invoke "peer0.org1.example.com" "my-channel1" "chaincode1" '{"Args":["KVContract:put", "name", "Willy Wonka"]}' ``` ### chaincodes list From a9cbac079d47f121cc967d240654442b746a3f3c Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 14 Feb 2025 11:32:00 +0100 Subject: [PATCH 295/471] Chore: Update MAINTAINERS.md Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- MAINTAINERS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index ad4b37b98..62572e6f1 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -3,6 +3,6 @@ ### Active Maintainers | name | Github | |-------------------|-----------| -| Piotr Hejwowski | [@hejwo](https://github.com/hejwo) | -| Jakub Dzikowski | [@dzikowski](https://github.com/dzikowski) | -| Grzegorz Hejduk | [@gzhk](https://github.com/gzhk) | +| Piotr Hejwowski | [@hejwo](https://github.com/hejwo) | +| Jakub Dzikowski | [@dzikowski](https://github.com/dzikowski) | +| Great Umegbewe | [@umegbewe](https://github.com/umegbewe) | From 3f9a5ac6cae3d4d3eae155f2ba41d167c36d88d3 Mon Sep 17 00:00:00 2001 From: Great Date: Fri, 21 Mar 2025 12:13:47 +0100 Subject: [PATCH 296/471] Merge pull request #513 from umegbewe/feat/support-fabric-v3-completion feat: fabric v3 support completion Signed-off-by: Pereowei Daniel --- CHANGELOG.md | 6 +++ e2e/__snapshots__/extendConfig.test.ts.snap | 10 ++--- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 38 ++++++++++--------- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 31 ++++++++------- fablo-build.sh | 2 +- .../fablo-config-hlf3-1orgs-1chaincode.json | 2 +- src/extend-config/extendGlobal.ts | 4 +- .../templates/fabric-config/configtx.yaml | 6 +++ .../fabric-docker/docker-compose.yaml | 4 ++ .../scripts/base-functions-v3.sh | 8 ++-- src/validate/index.ts | 37 +++++++++--------- 11 files changed, 86 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c00d166a..c5d0bdbf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.2.0 + +### Features +* Full support for Fabric 3.0.0 and drop solo consensus + [#513](https://github.com/hyperledger-labs/fablo/pull/513) + ## 2.1.0 ### Features diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 0473ec547..ee52ee4fb 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -9806,14 +9806,14 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "3.0.0-beta", + "fabricBaseosVersion": "3.0.0", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "3.0.0-beta", + "fabricCcenvVersion": "3.0.0", "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "3.0.0-beta", - "fabricVersion": "3.0.0-beta", + "fabricToolsVersion": "3.0.0", + "fabricVersion": "3.0.0", "monitoring": { "loglevel": "debug", }, @@ -10770,7 +10770,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = "fabricJavaenvVersion": "2.5", "fabricNodeenvVersion": "2.5", "fabricRecommendedNodeVersion": "16", - "fabricToolsVersion": "3.0.0-beta", + "fabricToolsVersion": "3.0.0", "fabricVersion": "3.0.0-beta", "monitoring": { "loglevel": "debug", diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 383677e96..c3eaa266f 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -43,7 +43,11 @@ Organizations: Name: OrdererMSP ID: OrdererMSP MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -64,7 +68,11 @@ Organizations: Name: Org1MSP ID: Org1MSP MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -115,11 +123,7 @@ Application: &ApplicationDefaults ################################################################################ Orderer: &Group1Defaults OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 - - orderer2.group1.orderer.example.com:7032 - - orderer3.group1.orderer.example.com:7033 + EtcdRaft: Consenters: - Host: orderer0.group1.orderer.example.com @@ -1521,12 +1525,12 @@ CHAINCODES_BASE_DIR= COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug -FABRIC_VERSION=3.0.0-beta -FABRIC_TOOLS_VERSION=3.0.0-beta +FABRIC_VERSION=3.0.0 +FABRIC_TOOLS_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=3.0.0-beta -FABRIC_BASEOS_VERSION=3.0.0-beta +FABRIC_CCENV_VERSION=3.0.0 +FABRIC_BASEOS_VERSION=3.0.0 FABRIC_JAVAENV_VERSION=2.5 FABRIC_NODEENV_VERSION=2.5 RECOMMENDED_NODE_VERSION=16 @@ -1920,7 +1924,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2146,7 +2150,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2305,7 +2309,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2341,7 +2345,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2378,7 +2382,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ + ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2417,7 +2421,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 40a05191a..1a117eabe 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -43,7 +43,11 @@ Organizations: Name: OrdererMSP ID: OrdererMSP MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -64,7 +68,11 @@ Organizations: Name: Org1MSP ID: Org1MSP MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - + OrdererEndpoints: + - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 + - orderer2.group1.orderer.example.com:7032 + - orderer3.group1.orderer.example.com:7033 Policies: Readers: Type: Signature @@ -115,11 +123,6 @@ Application: &ApplicationDefaults ################################################################################ Orderer: &Group1Defaults OrdererType: BFT - Addresses: - - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 - - orderer2.group1.orderer.example.com:7032 - - orderer3.group1.orderer.example.com:7033 SmartBFT: RequestBatchMaxCount: 100 @@ -1548,7 +1551,7 @@ COMPOSE_PROJECT_NAME= LOGGING_LEVEL=debug FABRIC_VERSION=3.0.0-beta -FABRIC_TOOLS_VERSION=3.0.0-beta +FABRIC_TOOLS_VERSION=3.0.0 FABRIC_CA_VERSION=1.5.5 FABRIC_CA_POSTGRES_VERSION=14 FABRIC_CCENV_VERSION=3.0.0-beta @@ -1945,7 +1948,7 @@ services: cli.orderer.example.com: container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2171,7 +2174,7 @@ services: cli.org1.example.com: container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + image: ghcr.io/fablo-io/fabric-tools:\${FABRIC_TOOLS_VERSION} tty: true environment: - GOPATH=/opt/gopath @@ -2330,7 +2333,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -2366,7 +2369,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -2403,7 +2406,7 @@ createChannelTx() { --name $CONTAINER_NAME \\ -v "$CONFIG_PATH":/fabric-config \\ -v "$OUTPUT_PATH":/output \\ - hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ + ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" \\ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile \${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID \${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -2442,7 +2445,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/fablo-build.sh b/fablo-build.sh index be08ec90d..a548f26b7 100755 --- a/fablo-build.sh +++ b/fablo-build.sh @@ -46,4 +46,4 @@ else --tag "$IMAGE_BASE_NAME" "$FABLO_HOME" docker tag "$IMAGE_BASE_NAME" "ghcr.io/fablo-io/fablo:$FABLO_VERSION" -fi +fi \ No newline at end of file diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index b7a78431c..e6715804f 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,7 +1,7 @@ { "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", "global": { - "fabricVersion": "3.0.0-beta", + "fabricVersion": "3.0.0", "tls": true, "monitoring": { "loglevel": "debug" diff --git a/src/extend-config/extendGlobal.ts b/src/extend-config/extendGlobal.ts index 0bd8abda3..7496bd175 100644 --- a/src/extend-config/extendGlobal.ts +++ b/src/extend-config/extendGlobal.ts @@ -24,11 +24,11 @@ const getVersions = (fabricVersion: string): FabricVersions => { const below3_0_0 = (v: string) => (v.startsWith("3.") ? "2.5" : v); - const beta3_0_0 = (v: string) => (v.startsWith("3.0.") ? "3.0.0-beta" : v); + const is_or_above3_0_0 = (v: string) => (v.startsWith("3.") ? "3.0.0" : v); return { fabricVersion, - fabricToolsVersion: beta3_0_0(fabricVersion), + fabricToolsVersion: is_or_above3_0_0(fabricVersion), fabricCaVersion: version(fabricVersion).isGreaterOrEqual("1.4.10") ? "1.5.5" : fabricVersion, fabricCcenvVersion: fabricVersion, fabricBaseosVersion: version(fabricVersion).isGreaterOrEqual("2.0") ? fabricVersion : "0.4.9", diff --git a/src/setup-docker/templates/fabric-config/configtx.yaml b/src/setup-docker/templates/fabric-config/configtx.yaml index 95c5d4d0f..5b0c3ec7f 100755 --- a/src/setup-docker/templates/fabric-config/configtx.yaml +++ b/src/setup-docker/templates/fabric-config/configtx.yaml @@ -35,6 +35,10 @@ Organizations: Name: <%= org.mspName %> ID: <%= org.mspName %> MSPDir: crypto-config/peerOrganizations/<%= org.domain %>/msp + <%_ if (global.capabilities.isV3) { _%> + OrdererEndpoints:<% ordererGroups[0].orderers.forEach(function(orderer) { %> + - <%= orderer.fullAddress %><% }) -%> + <%_ } _%> Policies: Readers: @@ -89,8 +93,10 @@ Application: &ApplicationDefaults <%_ ordererGroups.forEach(function(ordererGroup) { _%> Orderer: &<%= ordererGroup.configtxOrdererDefaults %> OrdererType: <%= ordererGroup.consensus %> + <%_ if (!global.capabilities.isV3) { _%> Addresses:<% ordererGroup.orderers.forEach(function(orderer) { %> - <%= orderer.fullAddress %><% })-%> + <%_ } _%> <%- include('configtx-raft-template.yaml.ejs', {ordererGroup: ordererGroup}); %> BatchTimeout: 2s BatchSize: diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 9b6232f6a..809ac9777 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -56,7 +56,11 @@ services: <%= org.cli.address %>: container_name: <%= org.cli.address %> + <%_ if(global.capabilities.isV3) { _%> + image: ghcr.io/fablo-io/fabric-tools:${FABRIC_TOOLS_VERSION} + <%_ } else { _%> image: hyperledger/fabric-tools:${FABRIC_TOOLS_VERSION} + <%_ } _%> tty: true environment: - GOPATH=/opt/gopath diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index da91a34be..6f7a094cb 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -22,7 +22,7 @@ certsGenerate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME @@ -58,7 +58,7 @@ genesisBlockCreate() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME @@ -95,7 +95,7 @@ createChannelTx() { --name $CONTAINER_NAME \ -v "$CONFIG_PATH":/fabric-config \ -v "$OUTPUT_PATH":/output \ - hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ + ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" \ bash -c "mkdir -p /output && configtxgen --configPath /fabric-config -profile ${CONFIG_PROFILE} -outputBlock /output/$CHANNEL_NAME.pb -channelID ${CHANNEL_NAME}" # shellcheck disable=SC2181 @@ -136,7 +136,7 @@ createNewChannelUpdateTx() { exit 1 fi - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker run -i -d -w="/" --name $CONTAINER_NAME ghcr.io/fablo-io/fabric-tools:"${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME diff --git a/src/validate/index.ts b/src/validate/index.ts index fd7044f53..08b4d901e 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -98,7 +98,7 @@ class ValidateGenerator extends Generator { // === Validate Orderers ============= this._validateIfOrdererDefinitionExists(networkConfig.orgs); - networkConfig.orgs.forEach((org) => this._validateOrdererCountForSoloType(org.orderers)); + networkConfig.orgs.forEach((org) => this._validateOrdererCountForSoloType(org.orderers, networkConfig.global)); networkConfig.orgs.forEach((org) => this._validateOrdererForRaftType(org.orderers, networkConfig.global)); networkConfig.orgs.forEach((org) => this._validateOrdererCountForOrg(org)); networkConfig.orgs.forEach((org) => this._validateOrdererGroupNameUniqueForOrg(org)); @@ -124,16 +124,7 @@ class ValidateGenerator extends Generator { } private _validateFabricVersion(global: GlobalJson) { - // 1. we support fabric up to 3.0.0-beta - if (version(global.fabricVersion).isGreaterOrEqual("3.0.0") && global.fabricVersion !== "3.0.0-beta") { - const objectToEmit = { - category: validationCategories.CRITICAL, - message: `Fabric ${global.fabricVersion} is not supported. Fablo supports only Fabric up to 3.0.0-beta.`, - }; - this.emit(validationErrorType.CRITICAL, objectToEmit); - } - - // 2. we support Fabric starting from 2.0.0 + // we support Fabric starting from 2.0.0 if (!version(global.fabricVersion).isGreaterOrEqual("2.0.0")) { const objectToEmit = { category: validationCategories.CRITICAL, @@ -246,15 +237,25 @@ class ValidateGenerator extends Generator { } } - _validateOrdererCountForSoloType(orderers: OrdererJson[] | undefined) { + _validateOrdererCountForSoloType(orderers: OrdererJson[] | undefined, global: GlobalJson) { if (orderers !== undefined) { orderers.forEach((orderer) => { - if (orderer.type === "solo" && orderer.instances > 1) { - const objectToEmit = { - category: validationCategories.ORDERER, - message: `Orderer consesus type is set to 'solo', but number of instances is ${orderer.instances}. Only 1 instance will be created.`, - }; - this.emit(validationErrorType.WARN, objectToEmit); + if (orderer.type === "solo") { + if (version(global.fabricVersion).isGreaterOrEqual("3.0.0")) { + const objectToEmit = { + category: validationCategories.ORDERER, + message: `Solo consensus type is not supported in Fabric version ${global.fabricVersion}. Please use 'raft' or 'bft' instead.`, + }; + this.emit(validationErrorType.ERROR, objectToEmit); + } + + if (orderer.instances > 1) { + const objectToEmit = { + category: validationCategories.ORDERER, + message: `Orderer consesus type is set to 'solo', but number of instances is ${orderer.instances}. Only 1 instance will be created.`, + }; + this.emit(validationErrorType.WARN, objectToEmit); + } } }); } From ef54fc1c4c0303c0ebd1a527ffc3ac81ba73438c Mon Sep 17 00:00:00 2001 From: Umegbewe Nwebedu Date: Fri, 21 Mar 2025 23:30:34 +0100 Subject: [PATCH 297/471] bump version 2.2.0 Signed-off-by: Umegbewe Nwebedu Signed-off-by: Pereowei Daniel --- README.md | 8 ++++---- docs/sample.json | 2 +- docs/schema.json | 2 +- ...ablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap | 2 +- ...g-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...o-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- ...blo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 +++--- e2e/__snapshots__/schema.test.ts.snap | 2 +- fablo.sh | 2 +- package-lock.json | 4 ++-- package.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-k8s.json | 2 +- .../fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode.json | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml | 2 +- samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml | 2 +- .../fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json | 2 +- samples/fablo-config-hlf3-1orgs-1chaincode.json | 2 +- samples/fablo-config-hlf3-bft-1orgs-1chaincode.json | 2 +- 24 files changed, 30 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 63b6a659d..cb7631880 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ You may keep the script in the root directory of your project or install it glob To install it globally: ```bash -sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo +sudo curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/fablo.sh -o /usr/local/bin/fablo && sudo chmod +x /usr/local/bin/fablo ``` To get a copy of Fablo for a single project, execute in the project root: ```bash -curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/fablo.sh -o ./fablo && chmod +x ./fablo +curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/fablo.sh -o ./fablo && chmod +x ./fablo ``` ## Getting started @@ -344,7 +344,7 @@ The basic structure of Fablo config file is as follows: ```json { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { ... }, "orgs": [ ... ], "channels": [ ... ], @@ -507,7 +507,7 @@ Genrated Hooks are saved in `fablo-target/hooks`. ```yaml --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json global: fabricVersion: 2.4.2 tls: false diff --git a/docs/sample.json b/docs/sample.json index 98635be5a..92b4c5f8c 100644 --- a/docs/sample.json +++ b/docs/sample.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": false, diff --git a/docs/schema.json b/docs/schema.json index 5959b4eae..a5548e3ee 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -12,7 +12,7 @@ ], "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json" + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json" }, "global": { "$id": "#/properties/global", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index d0652318e..7cff81ecf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -86,7 +86,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper REPOSITORY="https://kfsoftware.github.io/hlf-helm-charts" STORAGE_CLASS=$(kubectl describe sc | grep Name | tr -s ' ' | cut -d ':' -f 2 | cut -d ' ' -f 2) -FABLO_VERSION=2.1.0 +FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_CONFIG= ORDERER_IMAGE=hyperledger/fabric-orderer diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 1d6eadd1a..443075c3d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1524,7 +1524,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 27cf0a253..5b51acee7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1435,7 +1435,7 @@ fi `; exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index f241869fa..1b41b84e0 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2096,7 +2096,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 3e152f3c7..5331d1d88 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3019,7 +3019,7 @@ fi `; exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 978b75863..f62301fa5 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3314,7 +3314,7 @@ fi `; exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index c3eaa266f..3ae1c9941 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1511,7 +1511,7 @@ fi `; exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 1a117eabe..5c3eb05d4 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1536,7 +1536,7 @@ fi `; exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"FABLO_VERSION=2.1.0 +"FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 HYPERLEDGER_EXPLORER_VERSION=1.1.8 diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 74c92c453..01450da29 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2965,7 +2965,7 @@ Validation warnings count: 0 exports[`init should init simple fablo config 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3019,7 +3019,7 @@ exports[`init should init simple fablo config 1`] = ` exports[`init should init simple fablo config with node chaincode 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, @@ -3081,7 +3081,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` exports[`init should init simple fablo config with node chaincode and rest api 1`] = ` "{ - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false, diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index c93059f0d..6cd28ee15 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -7,7 +7,7 @@ exports[`schema should match snapshot 1`] = ` "default": {}, "properties": { "$schema": { - "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "const": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", }, "chaincodes": { "$id": "#/properties/chaincodes", diff --git a/fablo.sh b/fablo.sh index 92b2e0eae..17990e38c 100755 --- a/fablo.sh +++ b/fablo.sh @@ -2,7 +2,7 @@ set -e -FABLO_VERSION=2.1.0 +FABLO_VERSION=2.2.0 FABLO_IMAGE_NAME="ghcr.io/fablo-io/fablo" FABLO_IMAGE="$FABLO_IMAGE_NAME:$FABLO_VERSION" diff --git a/package-lock.json b/package-lock.json index 42ab6c18c..bf6e70126 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "generator-fablo", - "version": "2.1.0", + "version": "2.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "generator-fablo", - "version": "2.1.0", + "version": "2.2.0", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index 4a88d1ebf..447b874cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-fablo", - "version": "2.1.0", + "version": "2.2.0", "description": "Fablo is a simple tool to generate the Hyperledger Fabric blockchain network and run it on Docker. It supports RAFT and solo consensus protocols, multiple organizations and channels, chaincode installation and upgrade.", "author": "Piotr Hejwowski , Jakub Dzikowski ", "repository": { diff --git a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json index 629ba983e..207c02030 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-k8s.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-k8s.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.4.7", "tls": false, diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index fd7196f06..21e02b857 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.3.3", "tls": true, diff --git a/samples/fablo-config-hlf2-1org-1chaincode.json b/samples/fablo-config-hlf2-1org-1chaincode.json index fb890fff2..9efeca16b 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode.json +++ b/samples/fablo-config-hlf2-1org-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.9", "tls": false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml index 4a31f8f39..6f3a00f66 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json global: fabricVersion: 2.4.7 tls: false diff --git a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml index c3a944074..9f4c6a515 100644 --- a/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml +++ b/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml @@ -1,5 +1,5 @@ --- -"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json +"$schema": https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json global: fabricVersion: 2.4.3 tls: true diff --git a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json index 91e0e3f6e..d34c0468d 100644 --- a/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.3.2", "tls": true, diff --git a/samples/fablo-config-hlf3-1orgs-1chaincode.json b/samples/fablo-config-hlf3-1orgs-1chaincode.json index e6715804f..5c726ec6e 100644 --- a/samples/fablo-config-hlf3-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "3.0.0", "tls": true, diff --git a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json index a35c76f07..c855db1aa 100644 --- a/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json +++ b/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json @@ -1,5 +1,5 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.1.0/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "3.0.0-beta", "tls": true, From d0c7d370bf188db91ae7322011bbf8908b1865ff Mon Sep 17 00:00:00 2001 From: Kalio <89003403+kalio007@users.noreply.github.com> Date: Fri, 11 Apr 2025 12:07:43 +0100 Subject: [PATCH 298/471] docs: clarify usage of global vs local fablo installation in README (#520) Signed-off-by: kalio007 Signed-off-by: Pereowei Daniel --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb7631880..5123feb4d 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,13 @@ curl -Lf https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/fablo To create a local Hyperledger Fabric network with Node.js chaincode and REST API client, install Fablo and execute: ```bash -./fablo init node rest +fablo init node rest # if installed globally +# or +./fablo init node rest # if using local script ./fablo up ``` -After a few minutes the whole network will be set up and running. +After a few minutes, the whole network will be set up and running. You can check the running nodes via `docker ps` or `docker stats`, and you can query the network with command line (via `cli.org1.example.com` container) or REST API client (via [Fablo REST](https://github.com/fablo-io/fablo-rest)). ## Basic usage From 93ddff21719ec8562df64cb632d98d3ca2b4340d Mon Sep 17 00:00:00 2001 From: Vijeta Priya <67923889+VijetaPriya47@users.noreply.github.com> Date: Mon, 14 Apr 2025 00:48:30 +0530 Subject: [PATCH 299/471] Fix #519: Check if post-generate.sh exists before executing (#521) Signed-off-by: Vijeta Priya Co-authored-by: Vijeta Priya Signed-off-by: Pereowei Daniel --- fablo.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fablo.sh b/fablo.sh index 17990e38c..b8a0c362c 100755 --- a/fablo.sh +++ b/fablo.sh @@ -191,7 +191,9 @@ generateNetworkConfig() { mkdir -p "$fablo_target" executeOnFabloDocker "fablo:setup-network" "$fablo_target" "$fablo_config" - ("$fablo_target/hooks/post-generate.sh") + if [ -f "$fablo_target/hooks/post-generate.sh" ]; then + ("$fablo_target/hooks/post-generate.sh") + fi } networkPrune() { From 86b3ccfa85e0f0f72d3034948c7edcb7dfebcdc7 Mon Sep 17 00:00:00 2001 From: Debayan Ghosh <66942246+debayangg@users.noreply.github.com> Date: Mon, 14 Apr 2025 01:03:42 +0530 Subject: [PATCH 300/471] Updated fablo.sh to check if /hooks/post-generate.sh exists (#526) Signed-off-by: Debayan Ghosh Co-authored-by: Debayan Ghosh Signed-off-by: Pereowei Daniel From de25400478f865eead37b6b9d78011f3e6998a0f Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Sat, 10 May 2025 12:36:29 -0500 Subject: [PATCH 301/471] feat: support installing chaincode from Docker image using CCAAS This change adds support for 'ccaas'-based chaincodes by allowing the use of a Docker image instead of a directory. It introduces validation for the presence of image and port when lang is 'ccaas', and adjusts packaging and installation logic to handle CCAAS chaincodes. Signed-off-by: Pereowei Daniel Signed-off-by: Real-Artisan Signed-off-by: Pereowei Daniel --- docs/schema.json | 40 +++++++++++++++++- e2e/__snapshots__/extendConfig.test.ts.snap | 22 ++++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 36 ++++++++++++++-- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 36 ++++++++++++++-- ...2chaincodes-private-data.yaml.test.ts.snap | 42 ++++++++++++++++--- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 42 ++++++++++++++++--- ...1chaincode-raft-explorer.json.test.ts.snap | 36 ++++++++++++++-- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 36 ++++++++++++++-- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 36 ++++++++++++++-- e2e/__snapshots__/schema.test.ts.snap | 38 +++++++++++++++++ e2e/schema.test.ts | 3 +- src/extend-config/extendChaincodesConfig.ts | 15 +++++++ .../chaincode-install-v2.sh | 6 ++- .../fabric-docker/docker-compose.yaml | 12 ++++++ .../scripts/chaincode-functions-v2.sh | 30 +++++++++++++ src/types/FabloConfigExtended.ts | 4 +- src/types/FabloConfigJson.ts | 6 ++- 17 files changed, 407 insertions(+), 33 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index a5548e3ee..645658096 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -439,7 +439,8 @@ "enum": [ "golang", "java", - "node" + "node", + "ccaas" ] }, "channel": { @@ -478,6 +479,19 @@ "title": "Chaincode directory", "type": "string" }, + "image": { + "$id": "#/properties/chaincodes/items/properties/image", + "title": "Chaincode image URI", + "type": "string", + "pattern": "^[a-zA-Z0-9\\.\\-]+$" + }, + "port": { + "$id": "#/properties/chaincodes/items/properties/port", + "title": "Chaincode port", + "type": "integer", + "minimum": 10, + "maximum": 65535 + }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "title": "Private data collections", @@ -522,6 +536,30 @@ } } } + }, + "required": [ + "name", + "version", + "lang", + "channel" + ], + "if": { + "properties": { + "lang": { + "const": "ccaas" + } + } + }, + "then": { + "required": [ + "image", + "port" + ] + }, + "else": { + "required": [ + "directory" + ] } }, "hooks": { diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index ee52ee4fb..7a9da733a 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -244,6 +244,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -334,6 +335,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1070,6 +1072,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1160,6 +1163,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1886,6 +1890,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1971,6 +1976,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -2760,6 +2766,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "OR('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -2850,6 +2857,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "or-policy-chaincode", + "port": undefined, "privateData": [ { "blockToLive": 0, @@ -3168,6 +3176,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -3258,6 +3267,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "and-policy-chaincode", + "port": undefined, "privateData": [ { "blockToLive": 0, @@ -4237,6 +4247,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "OR ('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -4332,6 +4343,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -4684,6 +4696,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "directory": "./chaincodes/chaincode-java-simple", "endorsement": "OR ('Org1MSP.member', 'Org2MSP.member')", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -4779,6 +4792,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "java", "name": "chaincode2", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -6804,6 +6818,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -6942,6 +6957,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -9429,6 +9445,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND ('Org1MSP.member')", + "image": undefined, "init": "{"Args":[]}", "instantiatingOrg": { "anchorPeers": [ @@ -9519,6 +9536,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -10387,6 +10405,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": "AND ('Org1MSP.member')", + "image": undefined, "init": "{"Args":[]}", "instantiatingOrg": { "anchorPeers": [ @@ -10477,6 +10496,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11302,6 +11322,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11387,6 +11408,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "lang": "node", "name": "chaincode1", + "port": undefined, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 443075c3d..a10131dc1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1727,7 +1727,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" @@ -1756,7 +1756,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" @@ -1803,7 +1803,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" @@ -2560,13 +2560,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 5b51acee7..f02bbcc80 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1680,7 +1680,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1710,7 +1710,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1758,7 +1758,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -2428,13 +2428,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 1b41b84e0..54c4d0126 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2397,7 +2397,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2414,7 +2414,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2447,7 +2447,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2466,7 +2466,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2529,7 +2529,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2548,7 +2548,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -3355,13 +3355,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 5331d1d88..66c590019 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3523,7 +3523,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3539,7 +3539,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3571,7 +3571,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3589,7 +3589,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3651,7 +3651,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3669,7 +3669,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -4764,13 +4764,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index f62301fa5..7d4d71c02 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3861,7 +3861,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3891,7 +3891,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3939,7 +3939,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -5276,13 +5276,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 3ae1c9941..dea7b8492 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1768,7 +1768,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1798,7 +1798,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1834,7 +1834,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2678,13 +2678,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 5c3eb05d4..c9c59c029 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1792,7 +1792,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1822,7 +1822,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1858,7 +1858,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2702,13 +2702,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6cd28ee15..1afa58a40 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -22,6 +22,18 @@ exports[`schema should match snapshot 1`] = ` "version": "0.0.1", }, ], + "else": { + "required": [ + "directory", + ], + }, + "if": { + "properties": { + "lang": { + "const": "ccaas", + }, + }, + }, "items": { "$id": "#/properties/chaincodes/items", "properties": { @@ -51,6 +63,12 @@ exports[`schema should match snapshot 1`] = ` "title": "Endorsement configuration", "type": "string", }, + "image": { + "$id": "#/properties/chaincodes/items/properties/image", + "pattern": "^[a-zA-Z0-9\\.\\-]+$", + "title": "Chaincode image URI", + "type": "string", + }, "init": { "$id": "#/properties/chaincodes/items/properties/init", "title": "Initialization arguments (for Hyperledger Fabric below 2.0)", @@ -67,6 +85,7 @@ exports[`schema should match snapshot 1`] = ` "golang", "java", "node", + "ccaas", ], "title": "Language", "type": "string", @@ -77,6 +96,13 @@ exports[`schema should match snapshot 1`] = ` "title": "Name", "type": "string", }, + "port": { + "$id": "#/properties/chaincodes/items/properties/port", + "maximum": 65535, + "minimum": 10, + "title": "Chaincode port", + "type": "integer", + }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "items": { @@ -137,6 +163,18 @@ exports[`schema should match snapshot 1`] = ` "title": "Chaincode", "type": "object", }, + "required": [ + "name", + "version", + "lang", + "channel", + ], + "then": { + "required": [ + "image", + "port", + ], + }, "title": "Chaincodes", "type": "array", }, diff --git a/e2e/schema.test.ts b/e2e/schema.test.ts index 40a3b87ee..2a2e7c9f4 100644 --- a/e2e/schema.test.ts +++ b/e2e/schema.test.ts @@ -251,12 +251,13 @@ describe("schema", () => { it("should validate chaincode language", () => { const withChaincodeLanguage = (l: string) => updatedBase((json: FabloConfigJson) => { - json.chaincodes[0].lang = l as "java" | "golang" | "node"; + json.chaincodes[0].lang = l as "java" | "golang" | "node" | "ccaas"; }); expect(withChaincodeLanguage("java")).toMatchSchema(schema); expect(withChaincodeLanguage("node")).toMatchSchema(schema); expect(withChaincodeLanguage("golang")).toMatchSchema(schema); + expect(withChaincodeLanguage("ccaas")).toMatchSchema(schema); expect(withChaincodeLanguage("cobol")).not.toMatchSchema(schema); }); diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index da7982046..dad6f852b 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -57,12 +57,27 @@ const extendChaincodesConfig = ( ); const privateDataConfigFile = privateData.length > 0 ? `collections/${chaincode.name}.json` : undefined; + if (chaincode.lang === "ccaas") { + if (!chaincode.image) { + throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify an image field`); + } + if (!chaincode.port) { + throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify a port field`); + } + } else { + if (!chaincode.directory) { + throw new Error(`Chaincode '${chaincode.name}' must specify a directory field when not of type 'ccaas'`); + } + } + return { directory: chaincode.directory, name: chaincode.name, version: chaincode.version, lang: chaincode.lang, channel, + image: chaincode.image, + port: chaincode.port, ...initParams, endorsement, instantiatingOrg: channel.instantiatingOrg, diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 8455856ee..3709e76cc 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -8,17 +8,21 @@ - global */-%> printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" -chaincodeBuild <% -%> +<% if (!chaincode.image) { -%> + chaincodeBuild <% -%> "<%= chaincode.name %>" <% -%> "<%= chaincode.lang %>" <% -%> "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> "<%= global.fabricRecommendedNodeVersion %>" +<% } -%> chaincodePackage <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> "<%= chaincode.name %>" <% -%> "$version" <% -%> "<%= chaincode.lang %>" <% -%> + "<%= chaincode.image || '' %>" <% -%> + "<%= chaincode.port || '' %>" <% -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" <% org.peers.forEach((peer) => { -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 809ac9777..60715b100 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -2,6 +2,18 @@ networks: basic: services: +<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> + <%= chaincode.name%>: + container_name: <%= chaincode.name %> + image: <%= chaincode.image %> + environment: + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= chaincode.port %> + - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + ports: + - "<%= chaincode.port %>:<%= chaincode.port %>" + networks: + - basic +<% } }) %> <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index f35d4c26d..2b453325a 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -87,13 +87,43 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CHAINCODE_PORT=$7 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + if [ -n "$CHAINCODE_IMAGE" ]; then + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + mkdir -p "$PACKAGE_DIR" + + echo "{\"type\":\"ccaas\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\"address\":\"$CHAINCODE_NAME:$CHAINCODE_PORT\",\"dial_timeout\":\"10s\",\"tls_required\":false}" > "$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + + mkdir -p "./chaincode-packages" + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + # clean up + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + return + fi + + # Default to using the local chaincode directory docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \ diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 65de5bc14..50ce55372 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -146,11 +146,13 @@ export interface OrgConfig { } export interface ChaincodeConfig { - directory: string; + directory?: string; name: string; version: string; lang: string; channel: ChannelConfig; + image?: string; + port?: number; init?: string; initRequired?: boolean; endorsement?: string; diff --git a/src/types/FabloConfigJson.ts b/src/types/FabloConfigJson.ts index bc50f916b..d43e78bde 100644 --- a/src/types/FabloConfigJson.ts +++ b/src/types/FabloConfigJson.ts @@ -54,12 +54,14 @@ export interface PrivateDataJson { export interface ChaincodeJson { name: string; version: string; - lang: "node" | "java" | "golang"; + lang: "node" | "java" | "golang" | "ccaas"; channel: string; init?: string; initRequired?: boolean; endorsement?: string; - directory: string; + directory?: string; + image?: string; + port?: number; privateData: PrivateDataJson[]; } From f62acac0f23562e61366f77400234b2760fe57a7 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Wed, 4 Jun 2025 05:46:56 -0500 Subject: [PATCH 302/471] Keep cc container running ang generate dynamic ports Signed-off-by: Real-Artisan Signed-off-by: Pereowei Daniel --- docs/schema.json | 45 +- e2e-network/docker/test-04-snapshot.sh | 15 + e2e/__snapshots__/extendConfig.test.ts.snap | 16 +- ...1chaincode-raft-explorer.json.test.ts.snap | 3348 +---------------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 16 +- ...2chaincodes-private-data.yaml.test.ts.snap | 25 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 25 +- ...1chaincode-raft-explorer.json.test.ts.snap | 16 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 16 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 16 +- e2e/__snapshots__/schema.test.ts.snap | 48 +- .../chaincodes/chaincode-kv-node/Dockerfile | 12 + .../chaincodes/chaincode-kv-node/package.json | 1 + ...ig-hlf2-1org-1chaincode-raft-explorer.json | 14 +- src/extend-config/extendChaincodesConfig.ts | 47 +- src/setup-docker/index.ts | 19 + .../fabric-docker/ccaas_builder/bin/build | 21 + .../fabric-docker/ccaas_builder/bin/detect | 11 + .../fabric-docker/ccaas_builder/bin/release | 11 + .../chaincode-install-v2.sh | 44 +- .../fabric-docker/docker-compose.yaml | 18 +- .../scripts/chaincode-functions-v2.sh | 25 +- src/types/FabloConfigExtended.ts | 6 + src/validate/index.ts | 42 +- test-output.txt | 64 + 25 files changed, 396 insertions(+), 3525 deletions(-) create mode 100644 samples/chaincodes/chaincode-kv-node/Dockerfile create mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build create mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect create mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release create mode 100644 test-output.txt diff --git a/docs/schema.json b/docs/schema.json index 645658096..58386a986 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -416,8 +416,20 @@ "name", "version", "lang", - "channel", - "directory" + "channel" + ], + "allOf": [ + { + "if": { + "properties": { "lang": { "const": "ccaas_builder"}} + }, + "then": { + "required": [ "image"] + }, + "else": { + "required": [ "directory" ] + } + } ], "properties": { "name": { @@ -440,7 +452,7 @@ "golang", "java", "node", - "ccaas" + "ccaas_builder" ] }, "channel": { @@ -482,8 +494,7 @@ "image": { "$id": "#/properties/chaincodes/items/properties/image", "title": "Chaincode image URI", - "type": "string", - "pattern": "^[a-zA-Z0-9\\.\\-]+$" + "type": "string" }, "port": { "$id": "#/properties/chaincodes/items/properties/port", @@ -536,30 +547,6 @@ } } } - }, - "required": [ - "name", - "version", - "lang", - "channel" - ], - "if": { - "properties": { - "lang": { - "const": "ccaas" - } - } - }, - "then": { - "required": [ - "image", - "port" - ] - }, - "else": { - "required": [ - "directory" - ] } }, "hooks": { diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index a952d6fa0..33c6bcf1f 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -5,10 +5,23 @@ set -e TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." +REGISTRY_PORT=5000 +REGISTRY_NAME="fablo-test-case-ccaas" +CHAINCODE_IMAGE="localhost:$REGISTRY_PORT/fablo-test-case-ccaas:0.0.1" export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json" +CHAINCODE_SRC="$FABLO_HOME/samples/chaincodes/chaincode-kv-node" + +echo "Starting local registry on port $REGISTRY_PORT" +docker run -d -p "$REGISTRY_PORT:$REGISTRY_PORT" --restart=always --name $REGISTRY_NAME registry:2 || true + +echo "Building CCAAS chaincode image..." +docker build -t "$CHAINCODE_IMAGE" "$CHAINCODE_SRC" + +echo "Pushing chaincode image to local registry..." +docker push "$CHAINCODE_IMAGE" networkUp() { "$FABLO_HOME/fablo-build.sh" @@ -25,6 +38,7 @@ networkDown() { sleep 2 (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) + docker rm -f "$REGISTRY_NAME" || true } waitForContainer() { @@ -57,6 +71,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" +waitForContainer "chaincode1-peer0.org1.example.com" "Starting chaincode container from image" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 7a9da733a..494b8ba45 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1888,9 +1888,9 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1974,9 +1974,9 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "port": undefined, + "port": 7052, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11320,9 +11320,9 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11406,9 +11406,9 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "port": undefined, + "port": 7052, "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index a10131dc1..b79c8f74e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3349 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"/config -/crypto-config -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"################################################################################ -# SECTION: Capabilities -################################################################################ -Capabilities: - Channel: &ChannelCapabilities - V2_0: true - Orderer: &OrdererCapabilities - V2_0: true - Application: &ApplicationCapabilities - V2_0: true - -################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - EtcdRaft: - Consenters: - - Host: orderer0.group1.orderer.example.com - Port: 7030 - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 1 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Orderer - - *Org1 - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *ApplicationCapabilities - Consortium: SampleConsortium - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-orderer", - "description": "Connection profile for Orderer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Orderer" - }, - "organizations": { - "Orderer": { - "mspid": "OrdererMSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.orderer.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.orderer.example.com": { - "url": "https://localhost:7020", - "caName": "ca.orderer.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-orderer -description: Connection profile for Orderer in Fablo network -version: 1.0.0 -client: - organization: Orderer -organizations: - Orderer: - mspid: OrdererMSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.orderer.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.orderer.example.com: - url: https://localhost:7020 - caName: ca.orderer.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Org1 in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1" - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.org1.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.org1.example.com": { - "url": "https://localhost:7040", - "caName": "ca.org1.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-org1 -description: Connection profile for Org1 in Fablo network -version: 1.0.0 -client: - organization: Org1 -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.org1.example.com: - url: https://localhost:7040 - caName: ca.org1.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - Template: - Count: 0 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Org1 - Domain: org1.example.com - Specs: - Template: - Count: 1 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Hyperledger Explorer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1", - "tlsEnable": true, - "enableAuthentication": true, - "adminCredential": { - "id": "admin", - "password": "adminpw" - }, - "connection": { - "timeout": { - "peer": { - "endorser": "300" - }, - "orderer": "300" - } - } - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "adminPrivateKey": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" - }, - "peers": [ - "peer0.org1.example.com" - ], - "signedCert": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" - } - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://peer0.org1.example.com:7041", - "tlsCACerts": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" - } - } - }, - "channels": { - "my-channel1": { - "peers": {} - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - orderer: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - org1: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - notifyOrgsAboutChannels - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "\${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "\${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.2.0 -FABLO_BUILD= -FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 - -COUCHDB_VERSION=3.1 -FABRIC_COUCHDB_VERSION=0.4.18 - -FABLO_CONFIG= -CHAINCODES_BASE_DIR= - -COMPOSE_PROJECT_NAME= -LOGGING_LEVEL=info - -FABRIC_VERSION=2.3.3 -FABRIC_TOOLS_VERSION=2.3.3 -FABRIC_CA_VERSION=1.5.5 -FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=2.3.3 -FABRIC_BASEOS_VERSION=2.3.3 -FABRIC_JAVAENV_VERSION=2.3 -FABRIC_NODEENV_VERSION=2.3 -RECOMMENDED_NODE_VERSION=12 - -ROOT_CA_ADMIN_NAME=admin -ROOT_CA_ADMIN_PASSWORD=adminpw - -ORDERER_CA_ADMIN_NAME=admin -ORDERER_CA_ADMIN_PASSWORD=adminpw - -ORG1_CA_ADMIN_NAME=admin -ORG1_CA_ADMIN_PASSWORD=adminpw - -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -chaincodeList() { - if [ "$#" -ne 2 ]; then - echo "Expected 2 parameters for chaincode list, but got: $*" - exit 1 - - elif [ "$1" = "peer0.org1.example.com" ]; then - - peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - - else - - echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" - exit 1 - - fi -} - -# Function to perform chaincode invoke. Accepts 5 parameters: -# 1. comma-separated peers -# 2. channel name -# 3. chaincode name -# 4. chaincode command -# 5. transient data (optional) -chaincodeInvoke() { - if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then - echo "Expected 4 or 5 parameters for chaincode list, but got: $*" - echo "Usage: fablo chaincode invoke [transient]" - exit 1 - fi - cli="" - peer_addresses="" - - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then - cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi - - if [ "$2" = "my-channel1" ]; then - ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" - fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" - -set -eu - -channelQuery() { - echo "-> Channel query: " + "$@" - - if [ "$#" -eq 1 ]; then - printChannelsHelp - - elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then - - peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif - - [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] - then - - peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - TARGET_FILE=\${6:-"$channel-config.json"} - - peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - BLOCK_NAME=$2 - TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - - peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - - else - - echo "$@" - echo "$1, $2, $3, $4, $5, $6, $7, $#" - printChannelsHelp - fi - -} - -printChannelsHelp() { - echo "Channel management commands:" - echo "" - - echo "fablo channel list org1 peer0" - echo -e "\\t List channels on 'peer0' of 'Org1'". - echo "" - - echo "fablo channel getinfo my-channel1 org1 peer0" - echo -e "\\t Get channel info on 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" - echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch my-channel1 org1 peer0 [file name]" - echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -generateArtifacts() { - printHeadline "Generating basic configs" "U1F913" - - printItalics "Generating crypto material for Orderer" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating crypto material for Org1" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating genesis block for group group1" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - - # Create directories to avoid permission errors on linux - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -startNetwork() { - printHeadline "Starting network" "U1F680" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - sleep 4 -} - -generateChannelsArtifacts() { - printHeadline "Generating config for 'my-channel1'" "U1F913" - createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -installChannels() { - printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - -} - -installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then - local version="0.0.1" - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - else - echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" - fi - -} - -installChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" - fi - fi -} - -runDevModeChaincode() { - local chaincodeName=$1 - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - local version="0.0.1" - printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" - - fi -} - -upgradeChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" - fi - fi -} - -notifyOrgsAboutChannels() { - - printHeadline "Creating new channel config blocks" "U1F537" - createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" - - printHeadline "Notyfing orgs about channels" "U1F4E2" - notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - printHeadline "Deleting new channel config blocks" "U1F52A" - deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" - -} - -printStartSuccessInfo() { - printHeadline "Done! Enjoy your fresh network" "U1F984" -} - -stopNetwork() { - printHeadline "Stopping network" "U1F68F" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) - sleep 4 -} - -networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do - echo "Removing container $container..." - docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" - done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do - echo "Removing image $image..." - docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" - done - - printf "Removing generated configs... \\U1F5D1 \\n" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - - printHeadline "Done! Network was purged" "U1F5D1" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Genesis file configuration (for solo and raft) - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_DB_TLS_ENABLED=false - - FABRIC_CA_SERVER_DB_TYPE=postgres - - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - depends_on: - db.ca.org1.example.com: - condition: service_healthy - networks: - - basic - - db.ca.org1.example.com: - container_name: db.ca.org1.example.com - image: postgres:\${FABRIC_CA_POSTGRES_VERSION} - environment: - - POSTGRES_PASSWORD=caDbPass12345 - - POSTGRES_USER=postgres - - POSTGRES_DB=fabriccaserver - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - fablo-rest.org1.example.com: - container_name: fablo-rest.org1.example.com - image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} - environment: - - PORT=8000 - - MSP_ID=Org1MSP - - FABRIC_CA_URL=https://ca.org1.example.com:7054 - - FABRIC_CA_NAME=ca.org1.example.com - - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 - - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - HFC_LOGGING={"error":"console","warn":"console","info":"console"} - volumes: - # note: fablo needs access to all anchor peer certs - - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro - ports: - - 8801:8000 - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - depends_on: - couchdb.peer0.org1.example.com: - condition: service_healthy - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: couchdb:\${COUCHDB_VERSION} - environment: - - COUCHDB_USER=peer0 - - COUCHDB_PASSWORD=peer0Password - healthcheck: - test: "curl -f http://localhost:5984/" - interval: 5s - timeout: 10s - retries: 7 - ports: - - 5100:5984 - networks: - - basic - - db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} - container_name: db.explorer.example.com - environment: - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWORD=password - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} - restart: on-failure:8 - container_name: explorer.example.com - environment: - - DATABASE_HOST=db.explorer.example.com - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWD=password - - LOG_LEVEL_APP=debug - - LOG_LEVEL_DB=debug - - LOG_LEVEL_CONSOLE=info - - LOG_CONSOLE_STDOUT=true - - DISCOVERY_AS_LOCALHOST=false - volumes: - - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json - - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile - - ../fabric-config/crypto-config:/tmp/crypto - ports: - - "7010:8080" - depends_on: - db.explorer.example.com: - condition: service_healthy - networks: - - basic -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -certsGenerate() { - local CONTAINER_NAME=certsGenerate - - local CONFIG_PATH=$1 - local CRYPTO_CONFIG_FILE_NAME=$2 - local ORG_PATH=$3 - local OUTPUT_PATH=$4 - local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH - - echo "Generating certs..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" - inputLog "ORG_PATH: $ORG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" - - if [ -d "$FULL_CERT_PATH" ]; then - echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME - - docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME - - # shellcheck disable=2044 - for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do - dir=$(dirname "$file") - mv "\${dir}"/*_sk "\${dir}"/priv-key.pem - done -} - -genesisBlockCreate() { - local CONTAINER_NAME=genesisBlockCreate - - local CONFIG_PATH=$1 - local OUTPUT_PATH=$2 - local GENESIS_PROFILE_NAME=$3 - local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block - - echo "Creating genesis block..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" - inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" - - if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then - echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME - - mkdir -p "$OUTPUT_PATH" - docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createChannelTx() { - local CONTAINER_NAME=createChannelTx - - local CHANNEL_NAME=$1 - local CONFIG_PATH=$2 - local CONFIG_PROFILE=$3 - local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx - - echo "Creating channelTx for $CHANNEL_NAME..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" - - if [ -f "$CHANNEL_TX_PATH" ]; then - echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createNewChannelUpdateTx() { - local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CONFIG_PROFILE=$3 - local CONFIG_PATH=$4 - local OUTPUT_PATH=$5 - - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then - echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen \\ - --configPath ./fabric-config \\ - -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ - -channelID "\${CHANNEL_NAME}" \\ - -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - - docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -notifyOrgAboutNewChannel() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -notifyOrgAboutNewChannelTls() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - local CA_CERT="/var/hyperledger/cli/"\${6} - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" \\ - --tls --cafile "$CA_CERT" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -deleteNewChannelUpdateTx() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" - inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -printHeadline() { - bold=$'\\e[1m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -printItalics() { - italics=$'\\e[3m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -inputLog() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -inputLogShort() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -certsRemove() { - local CERTS_DIR_PATH=$1 - rm -rf "$CERTS_DIR_PATH" -} - -removeContainer() { - CONTAINER_NAME=$1 - docker rm -f "$CONTAINER_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -printHelp() { - echo "Fablo is powered by SoftwareMill" - - echo "" - echo "usage: ./fabric-docker.sh " - echo "" - - echo "Commands: " - echo "" - echo "./fabric-docker.sh up" - echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." - echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" - echo "" - echo "./fabric-docker.sh down" - echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." - echo "" - echo "./fabric-docker.sh start" - echo -e "\\t Starts already created network." - echo "" - echo "./fabric-docker.sh stop" - echo -e "\\t Stops already running network." - echo "" - echo "./fabric-docker.sh reset" - echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." - echo "" - echo "./fabric-docker.sh channel --help" - echo -e "\\t Detailed help for channel management scripts." - echo "" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash -# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. -# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u - -dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" - fi -} - -node_version_check() { - - local fabric_shim_version="$1" - local nodejs_version - - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 - - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 - - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 - - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 - - else - nodejs_version=18.12 - fi - - echo $nodejs_version - -} - -chaincodeBuild() { - local CHAINCODE_NAME=$1 - local CHAINCODE_LANG=$2 - local CHAINCODE_DIR_PATH=$3 - local RECOMMENDED_NODE_VERSION=$4 - - mkdir -p "$CHAINCODE_DIR_PATH" - - # pull required images upfront in case of arm64 (Apple Silicon) architecture - # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately - # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly - if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then - if [ "$CHAINCODE_LANG" = "node" ]; then - dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "java" ]; then - dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "golang" ]; then - dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" - fi - fi - - if [ "$CHAINCODE_LANG" = "node" ]; then - NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") - RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") - - if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then - echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" - echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" - fi - - echo "Buiding chaincode '$CHAINCODE_NAME'..." - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" - inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - - # Default to using npm for installation and build - (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - - fi -} - -chaincodePackage() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" - - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi - - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodeInstall() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CA_CERT=$5 - - echo "Installing chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA_CERT: $CA_CERT" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") - fi - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeApprove() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COLLECTIONS_CONFIG=\${10} - - echo "Approving chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYINSTALLED_RESPONSE - local CC_PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - if [ -z "$CC_PACKAGE_ID" ]; then - CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" - fi - inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --package-id "$CC_PACKAGE_ID" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeCommit() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COMMIT_PEER_ADDRESSES=\${10} - local TLS_ROOT_CERT_FILES=\${11} - local COLLECTIONS_CONFIG=\${12} - - echo "Committing chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" - inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local COMMIT_PEER_PARAMS=() - if [ -n "$COMMIT_PEER_ADDRESSES" ]; then - # shellcheck disable=SC2207 - COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) - fi - - local TLS_ROOT_CERT_PARAMS=() - if [ -n "$TLS_ROOT_CERT_FILES" ]; then - # shellcheck disable=SC2207 - TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ - "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -peerChaincodeList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - - # Execute the command to list chaincodes - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" -} - -peerChaincodeListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - local CA_CERT=$4 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CA_CERT: $CA_CERT" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" -} - -# Function to perform chaincode invoke -peerChaincodeInvoke() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - 2>&1 -} -# Function to perform chaincode invoke for Tls -peerChaincodeInvokeTls() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - local PEER_CERTS="$7" - local CA_CERT="$8" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - inputLog "PEER_CERTS: $PEER_CERTS" - inputLog "CA_CERT: $CA_CERT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - $TLS_ROOT_CERT_FILES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" \\ - 2>&1 -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -peerChannelList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list -} - -peerChannelGetInfo() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" -} - -peerChannelFetchConfig() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlock() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local TARGET_FILE="$5" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} - -#=== TLS equivalents ========================================================= - -peerChannelListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CA_CERT=$3 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" -} - -peerChannelGetInfoTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - local CA_CERT=$4 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" -} - -peerChannelFetchConfigTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - local CA_CERT=$5 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlockTls() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local CA_CERT="$5" - local TARGET_FILE="$6" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -createChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx - peer channel join -b "\${CHANNEL_NAME}".block - - rm -rf "$DIR_NAME" -} - -createChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" - peer channel join -b "\${CHANNEL_NAME}"_newest.block - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -__getOrdererAndPeerNodes() { - echo " - orderer0.group1.orderer.example.com - peer0.org1.example.com - " -} - -__getCASQLiteNodes() { - echo " - ca.orderer.example.com - " -} - -__getCAPostgresNodes() { - echo " - db.ca.org1.example.com - " -} - -__createSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" - - if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then - echo "Error: Directory '$backup_dir' already exists and is not empty!" - exit 1 - fi - - mkdir -p "$backup_dir" - cp -R ./fablo-target "$backup_dir/" - - for node in $(__getCASQLiteNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node" - docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" - done - - for node in $(__getCAPostgresNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node/pg-data" - docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Saving state of $node..." - docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" - done -} - -__cloneSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - target_dir="$1" - hook_cmd="$2" - - if [ -d "$target_dir/fablo-target" ]; then - echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." - exit 1 - fi - - cp -R ./fablo-target "$target_dir/fablo-target" - - if [ -n "$hook_cmd" ]; then - echo "Executing pre-restore hook: '$hook_cmd'" - (cd "$target_dir" && eval "$hook_cmd") - fi - - (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) - - for node in $(__getCASQLiteNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" - fi - done - - for node in $(__getCAPostgresNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" - fi - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/" "$node:/var/hyperledger/production/" - fi - done -} - -createSnapshot() { - (set -eu && __createSnapshot "$1") -} - -cloneSnapshot() { - (set -eu && __cloneSnapshot "$1" "$2") -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -# The code from this file was called after Fablo generated Hyperledger Fabric configuration -echo "Executing post-generate hook" - -perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -[ - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", -] -`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index f02bbcc80..ce77dfe03 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1680,7 +1680,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1710,7 +1711,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1758,7 +1760,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -2430,6 +2433,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -2438,17 +2442,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -2459,6 +2464,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 54c4d0126..0bb466a84 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2397,7 +2397,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2414,7 +2415,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2447,7 +2449,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2466,7 +2469,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2529,7 +2533,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2548,7 +2553,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" + printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -3357,6 +3363,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -3365,17 +3372,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -3386,6 +3394,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 66c590019..636e12a37 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3523,7 +3523,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3539,7 +3540,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" + printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3571,7 +3573,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3589,7 +3592,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" + printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3651,7 +3655,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3669,7 +3674,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" + printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -4766,6 +4772,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -4774,17 +4781,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -4795,6 +4803,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 7d4d71c02..be83549d6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3861,7 +3861,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3891,7 +3892,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3939,7 +3941,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -5278,6 +5281,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -5286,17 +5290,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -5307,6 +5312,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index dea7b8492..da1c8ff76 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1768,7 +1768,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1798,7 +1799,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1834,7 +1836,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2680,6 +2683,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -2688,17 +2692,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -2709,6 +2714,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index c9c59c029..2655c37cd 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1792,7 +1792,8 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1822,7 +1823,8 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1858,7 +1860,8 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2704,6 +2707,7 @@ chaincodePackage() { local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CHAINCODE_PORT=$7 + local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" @@ -2712,17 +2716,18 @@ chaincodePackage() { inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" mkdir -p "$PACKAGE_DIR" echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":false}" >"$PACKAGE_DIR/code/connection.json" + echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json @@ -2733,6 +2738,7 @@ chaincodePackage() { # clean up rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 1afa58a40..d6b97b808 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -22,20 +22,30 @@ exports[`schema should match snapshot 1`] = ` "version": "0.0.1", }, ], - "else": { - "required": [ - "directory", - ], - }, - "if": { - "properties": { - "lang": { - "const": "ccaas", - }, - }, - }, "items": { "$id": "#/properties/chaincodes/items", + "allOf": [ + { + "else": { + "required": [ + "directory", + ], + }, + "if": { + "properties": { + "lang": { + "const": "ccaas", + }, + }, + }, + "then": { + "required": [ + "image", + "port", + ], + }, + }, + ], "properties": { "channel": { "$id": "#/properties/chaincodes/items/properties/channel", @@ -65,7 +75,6 @@ exports[`schema should match snapshot 1`] = ` }, "image": { "$id": "#/properties/chaincodes/items/properties/image", - "pattern": "^[a-zA-Z0-9\\.\\-]+$", "title": "Chaincode image URI", "type": "string", }, @@ -158,23 +167,10 @@ exports[`schema should match snapshot 1`] = ` "version", "lang", "channel", - "directory", ], "title": "Chaincode", "type": "object", }, - "required": [ - "name", - "version", - "lang", - "channel", - ], - "then": { - "required": [ - "image", - "port", - ], - }, "title": "Chaincodes", "type": "array", }, diff --git a/samples/chaincodes/chaincode-kv-node/Dockerfile b/samples/chaincodes/chaincode-kv-node/Dockerfile new file mode 100644 index 000000000..8f6607602 --- /dev/null +++ b/samples/chaincodes/chaincode-kv-node/Dockerfile @@ -0,0 +1,12 @@ +FROM node:18 + +WORKDIR /usr/src/app + +COPY package*.json ./ +RUN npm install + +COPY . . + +EXPOSE 7052 + +CMD ["npm", "run", "start:ccaas"] \ No newline at end of file diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index 5314d7394..58ef74226 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -8,6 +8,7 @@ }, "scripts": { "start": "fabric-chaincode-node start", + "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\" ", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 21e02b857..23b8be15e 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,11 +1,8 @@ { - "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", + "$schema": "../docs/schema.json", "global": { "fabricVersion": "2.3.3", - "tls": true, - "tools": { - "explorer": true - } + "tls": true }, "orgs": [ { @@ -32,9 +29,6 @@ "peer": { "instances": 1, "db": "CouchDb" - }, - "tools": { - "fabloRest": true } } ], @@ -55,9 +49,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas_builder", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "image": "localhost:5000/fablo-test-case-ccaas:0.0.1" } ], "hooks": { diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index dad6f852b..fcbb81c97 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -42,6 +42,7 @@ const extendChaincodesConfig = ( transformedChannels: ChannelConfig[], network: Global, ): ChaincodeConfig[] => { + let portCounter = 7052; return chaincodes.map((chaincode) => { const channel = transformedChannels.find((c) => c.name === chaincode.channel); if (!channel) throw new Error(`No matching channel with name '${chaincode.channel}'`); @@ -57,33 +58,35 @@ const extendChaincodesConfig = ( ); const privateDataConfigFile = privateData.length > 0 ? `collections/${chaincode.name}.json` : undefined; + const peerChaincodeInstances = !chaincode.image ? [] : channel.orgs.flatMap((org) => + org.peers.map((peer) => { + return { + containerName: `${peer.address}_${chaincode.name}`, + peerAddress: peer.address, + port: portCounter++, + }; + }) + ); + if (chaincode.lang === "ccaas") { if (!chaincode.image) { throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify an image field`); } - if (!chaincode.port) { - throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify a port field`); - } - } else { - if (!chaincode.directory) { - throw new Error(`Chaincode '${chaincode.name}' must specify a directory field when not of type 'ccaas'`); - } } - - return { - directory: chaincode.directory, - name: chaincode.name, - version: chaincode.version, - lang: chaincode.lang, - channel, - image: chaincode.image, - port: chaincode.port, - ...initParams, - endorsement, - instantiatingOrg: channel.instantiatingOrg, - privateDataConfigFile, - privateData, - }; + return { + directory: chaincode.directory, + name: chaincode.name, + version: chaincode.version, + lang: chaincode.lang, + channel, + image: chaincode.image, + ...initParams, + endorsement, + instantiatingOrg: channel.instantiatingOrg, + privateDataConfigFile, + peerChaincodeInstances, + privateData, + }; }); }; diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 081ea4890..e88a7804b 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -64,6 +64,7 @@ export default class SetupDockerGenerator extends Generator { // ======= fabric-docker =========================================================== this._copyDockerComposeEnv(global, orgs, composeNetworkName); this._copyDockerCompose(config); + this._copyBuildScripts(config); // ======= scripts ================================================================== this._copyCommandsGeneratedScript(config); @@ -178,6 +179,24 @@ export default class SetupDockerGenerator extends Generator { ); } + _copyBuildScripts(config: FabloConfigExtended): void { + this.fs.copyTpl( + this.templatePath("fabric-docker/ccaas_builder/bin/build"), + this.destinationPath("fabric-docker/ccaas_builder/bin/build"), + config, + ); + this.fs.copyTpl( + this.templatePath("fabric-docker/ccaas_builder/bin/detect"), + this.destinationPath("fabric-docker/ccaas_builder/bin/detect"), + config, + ); + this.fs.copyTpl( + this.templatePath("fabric-docker/ccaas_builder/bin/release"), + this.destinationPath("fabric-docker/ccaas_builder/bin/release"), + config, + ); + } + _copyCommandsGeneratedScript(config: FabloConfigExtended): void { this.fs.copyTpl( this.templatePath("fabric-docker/channel-query-scripts.sh"), diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build new file mode 100755 index 000000000..0c11107ef --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +SOURCE=$1 +OUTPUT=$3 + +#external chaincodes expect connection.json file in the chaincode package +if [ ! -f "$SOURCE/connection.json" ]; then + >&2 echo "$SOURCE/connection.json not found" + exit 1 +fi + +#simply copy the endpoint information to specified output location +cp $SOURCE/connection.json $OUTPUT/connection.json + +if [ -d "$SOURCE/metadata" ]; then + cp -a $SOURCE/metadata $OUTPUT/metadata +fi + +exit 0 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect new file mode 100755 index 000000000..8b35fcc16 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect @@ -0,0 +1,11 @@ +#!/bin/bash + +set -euo pipefail + +METADIR=$2 +#check if the "type" field is set to "external" +if [ "$(jq -r .type "$METADIR/metadata.json")" == "external" ]; then + exit 0 +fi + +exit 1 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release new file mode 100755 index 000000000..3ef77ad9a --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +CONFIG="${CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG:-{}}" +echo "Releasing chaincode using config: $CONFIG" >&2 + +mkdir -p /tmp/ccaas_extratct +tar -xzf code.tar.gz -C /tmp/ccaas_extratct + +cat /tmp/ccaas_extratct/connection.json \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 3709e76cc..464a46acf 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -8,21 +8,37 @@ - global */-%> printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" -<% if (!chaincode.image) { -%> - chaincodeBuild <% -%> - "<%= chaincode.name %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> - "<%= global.fabricRecommendedNodeVersion %>" +<% if (chaincode.lang === 'ccaas_builder') { -%> + <% chaincode.peerChaincodeInstances.forEach((instance) => { -%> + chaincodePackage <% -%> + "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + "<%= instance.peerAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.image %>" <% -%> + "<%= instance.port %>" <% -%> + "<%= instance.containerName %>" <% -%> + "<%= global.tls %>" + <% }) -%> +<% } else { -%> + <% if (!chaincode.image) { -%> + chaincodeBuild <% -%> + "<%= chaincode.name %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> + "<%= global.fabricRecommendedNodeVersion %>" + <% } -%> + chaincodePackage <% -%> + "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> + "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.image || '' %>" <% -%> + "<%= chaincode.port || '' %>" <% -%> + "<%= global.tls %>" <% } -%> -chaincodePackage <% -%> - "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> - "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.lang %>" <% -%> - "<%= chaincode.image || '' %>" <% -%> - "<%= chaincode.port || '' %>" <% -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" <% org.peers.forEach((peer) => { -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 60715b100..2f6c4dd60 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -3,17 +3,21 @@ networks: services: <% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> - <%= chaincode.name%>: - container_name: <%= chaincode.name %> + <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> + <%= instance.containerName %>: + container_name: <%= instance.containerName %> image: <%= chaincode.image %> + pull_policy: always environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= chaincode.port %> + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> ports: - - "<%= chaincode.port %>:<%= chaincode.port %>" + - <%= instance.port %>:7052 networks: - - basic + - basic + <% }) %> <% } }) %> + <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> @@ -255,6 +259,7 @@ services: container_name: <%= peer.address %> image: hyperledger/fabric-peer:${FABRIC_VERSION} environment: + - CORE_CHAINCODE_EXTERNALBUILDERS=[{"name":"external","path":"/opt/hyperledger/ccaas_builder","propagateEnvironment":["CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG"]}] - CORE_PEER_LOCALMSPID=<%= org.mspName %> - CORE_PEER_ID=<%= peer.address %> - CORE_PEER_ADDRESS=<%= peer.fullAddress %> @@ -297,6 +302,8 @@ services: <%_ if(peer.gatewayEnabled) { _%> # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG="{\"peername\":\"<%= peer.address %>\"}" <%_ } _%> working_dir: /etc/hyperledger/fabric/peer/ command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> @@ -317,6 +324,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/peers/<%= peer.address %>/tls:/etc/hyperledger/fabric/peer/tls - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/users:/etc/hyperledger/fabric/peer/msp/users - ../fabric-config/config:/etc/hyperledger/fabric/config + - ./ccaas_builder:/opt/hyperledger/ccaas_builder networks: - basic <%_ if(peer.db.type==="CouchDb") { _%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 2b453325a..0ac8dce7c 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -88,36 +88,47 @@ chaincodePackage() { local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "TLS_ENABLED: $TLS_ENABLED" if [ -n "$CHAINCODE_IMAGE" ]; then echo "Packaging chaincode as CCAAS (external builder)..." - local PACKAGE_DIR="/tmp/ccaas_$CHAINCODE_LABEL" + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\"type\":\"ccaas\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + echo "{\"type\":\"external\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\"address\":\"$CHAINCODE_NAME:$CHAINCODE_PORT\",\"dial_timeout\":\"10s\",\"tls_required\":false}" > "$PACKAGE_DIR/code/connection.json" + echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json mkdir -p "./chaincode-packages" tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + if docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; then + echo "Successfully copied chaincode package to $CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + else + echo "Failed to copy chaincode package to container" >&2 + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + return 1 + fi # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" return diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 50ce55372..13be30f3c 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -145,6 +145,11 @@ export interface OrgConfig { tools: { fabloRest?: FabloRestConfig; explorer?: ExplorerConfig }; } +export interface peerChaincodeInstances{ + containerName: string; + peerAddress: string; + port: number; +} export interface ChaincodeConfig { directory?: string; name: string; @@ -153,6 +158,7 @@ export interface ChaincodeConfig { channel: ChannelConfig; image?: string; port?: number; + peerChaincodeInstances?: peerChaincodeInstances[]; init?: string; initRequired?: boolean; endorsement?: string; diff --git a/src/validate/index.ts b/src/validate/index.ts index 08b4d901e..cb9683b29 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -1,5 +1,5 @@ import * as Generator from "yeoman-generator"; -import { Validator as SchemaValidator } from "jsonschema"; +// import { Validator as SchemaValidator } from "jsonschema"; import * as chalk from "chalk"; import * as config from "../config"; import parseFabloConfig from "../utils/parseFabloConfig"; @@ -91,7 +91,7 @@ class ValidateGenerator extends Generator { const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); this._validateFabricVersion(networkConfig.global); - this._validateJsonSchema(networkConfig); + // this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); this._validateEngineSpecificSettings(networkConfig); @@ -169,25 +169,25 @@ class ValidateGenerator extends Generator { } } - _validateJsonSchema(configToValidate: FabloConfigJson) { - const validator = new SchemaValidator(); - const results = validator.validate(configToValidate, config.schema); - results.errors.forEach((result) => { - const msg = `${result.property} : ${result.message}`; - const objectToEmit = { - category: validationCategories.VALIDATION, - message: msg, - }; - this.emit(validationErrorType.ERROR, objectToEmit); - }); - if (results.errors.length > 0) { - const objectToEmit = { - category: validationCategories.CRITICAL, - message: "Json schema validation failed!", - }; - this.emit(validationErrorType.CRITICAL, objectToEmit); - } - } + // _validateJsonSchema(configToValidate: FabloConfigJson) { + // const validator = new SchemaValidator(); + // const results = validator.validate(configToValidate, config.schema); + // results.errors.forEach((result) => { + // const msg = `${result.property} : ${result.message}`; + // const objectToEmit = { + // category: validationCategories.VALIDATION, + // message: msg, + // }; + // this.emit(validationErrorType.ERROR, objectToEmit); + // }); + // if (results.errors.length > 0) { + // const objectToEmit = { + // category: validationCategories.CRITICAL, + // message: "Json schema validation failed!", + // }; + // this.emit(validationErrorType.CRITICAL, objectToEmit); + // } + // } _printIfNotEmpty(messages: Message[], caption: string) { if (messages.length > 0) { diff --git a/test-output.txt b/test-output.txt new file mode 100644 index 000000000..218c52003 --- /dev/null +++ b/test-output.txt @@ -0,0 +1,64 @@ + +> generator-fablo@2.2.0 test:e2e-update +> ./fablo-build.sh && jest e2e --runInBand --updateSnapshot && ./lint.sh + +allexport off +braceexpand on +emacs off +errexit on +errtrace off +functrace off +hashall on +histexpand off +history off +ignoreeof off +interactive-comments on +keyword off +monitor off +noclobber off +noexec off +noglob off +nolog off +notify off +nounset on +onecmd off +physical off +pipefail off +posix off +privileged off +verbose off +vi off +xtrace off +Building new image... + FABLO_HOME: /Users/artisan/Documents/workwith/opensource/fablo + FABLO_VERSION: 2.2.0 + VERSION_DETAILS: 2025-05-12-10:46:36-9154382 +Found '/Users/artisan/Documents/workwith/opensource/fablo/.nvmrc' with version <18> +Now using node v18.20.8 (npm v10.8.2) + +up to date, audited 1194 packages in 4s + +154 packages are looking for funding + run `npm fund` for details + +11 moderate severity vulnerabilities + +To address issues that do not require attention, run: + npm audit fix + +To address all issues (including breaking changes), run: + npm audit fix --force + +Run `npm audit` for details. + +> generator-fablo@2.2.0 build:dist +> npm run clean && tsc -p tsconfig-dist.json && npm run copydeps + + +> generator-fablo@2.2.0 clean +> rimraf generators + + +> generator-fablo@2.2.0 copydeps +> copyfiles --all --up 1 'src/*/templates/**' generators + From c071869b2012250014f49916cac143f0c9f4ec6b Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Thu, 5 Jun 2025 05:46:40 -0500 Subject: [PATCH 303/471] use lang in type for metadata.json Signed-off-by: Real-Artisan change fabric version Signed-off-by: Real-Artisan Chaincode install test passed Signed-off-by: Real-Artisan fix-Chaincode install test passed with Fabric version 2.5.12 Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan Fix tag format for release CI (#504) fix: correct typo in CONTRIBUTING.md (#538) Signed-off-by: kalio007 Added Fablo Sample Gateway Connection for Node.js (#541) Signed-off-by: Ronald L Co-authored-by: Jakub Dzikowski feat: Add cross-platform testing on macOS (#546) * feat: Add cross-platform testing on macOS Signed-off-by: Osama Rabea * Fix 'docker: command not found' in test-cross-platform job by adding Docker setup Signed-off-by: Osama Rabea * Simplify test-cross-platform Signed-off-by: Osama Rabea * fix(ci): use docker driver for Buildx to support macOS runners Signed-off-by: Osama Rabea * fix(ci): avoid Docker issues on macOS by using setup-docker-macos-action Signed-off-by: Osama Rabea * configure test-5-v3 to run on macos-15 arm with Docker + Colima Signed-off-by: Osama Rabea --------- Signed-off-by: Osama Rabea Fix chaincode invoke CLI for endorsement policy involving multiple peers (#549) Feat: Test cases for `repositoryUtils.ts` (#548) Chore: Unit tests for `parseFabloConfig` (#552) Signed-off-by: Abhinav Pandey Hardcoded Fablo config for `init` command (#554) Feat: Publish sample chaincode Docker image (#555) Co-authored-by: Pereowei Daniel Co-authored-by: Jakub Dzikowski fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel Fix-review comments and file changes Signed-off-by: Pereowei Daniel Fix-updated test suites for new code changes Signed-off-by: Pereowei Daniel fix-validate json schema Signed-off-by: Pereowei Daniel fix-re-enable explorer test and update changelog Signed-off-by: Pereowei Daniel fix-re-enable explorer test and update changelog Signed-off-by: Pereowei Daniel --- .DS_Store | Bin 0 -> 6148 bytes .github/workflows/publish-docker-on-main.yml | 8 + .github/workflows/release-on-tag.yml | 4 +- .github/workflows/test-on-push.yml | 25 +- .gitignore | 1 + CHANGELOG.md | 12 + CONTRIBUTING.md | 2 +- Dockerfile | 1 - docs/schema.json | 4 +- e2e-network/TEST_CASES.md | 40 +- e2e-network/docker/test-03-private-data.sh | 23 +- e2e-network/docker/test-04-snapshot.sh | 15 +- e2e/__snapshots__/extendConfig.test.ts.snap | 142 +- ...1chaincode-raft-explorer.json.test.ts.snap | 3367 ++++++++++++++++- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 106 +- ...2chaincodes-private-data.yaml.test.ts.snap | 122 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 148 +- ...1chaincode-raft-explorer.json.test.ts.snap | 149 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 117 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 117 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 94 +- e2e/__snapshots__/schema.test.ts.snap | 1 - e2e/fabloCommands.test.ts | 2 + e2e/schema.test.ts | 1 - .../chaincodes/chaincode-kv-node/Dockerfile | 2 +- .../chaincodes/chaincode-kv-node/package.json | 3 +- ...ig-hlf2-1org-1chaincode-raft-explorer.json | 16 +- samples/gateway/node/.env.example | 9 + samples/gateway/node/README.md | 25 + samples/gateway/node/package-lock.json | 429 +++ samples/gateway/node/package.json | 21 + samples/gateway/node/server.js | 40 + src/init/index.ts | 78 +- src/repositoryUtils.test.ts | 71 +- src/setup-docker/index.ts | 19 - .../fabric-docker/ccaas_builder/bin/build | 21 - .../fabric-docker/ccaas_builder/bin/detect | 11 - .../fabric-docker/ccaas_builder/bin/release | 11 - .../fabric-docker/chaincode-scripts.sh | 48 +- .../fabric-docker/channel-query-scripts.sh | 2 - .../chaincode-install-v2.sh | 7 +- .../fabric-docker/docker-compose.yaml | 37 +- .../scripts/chaincode-functions-v2.sh | 81 +- src/utils/parseFabloConfig.test.ts | 149 + src/validate/index.ts | 42 +- test-output.txt | 64 - 46 files changed, 4895 insertions(+), 792 deletions(-) create mode 100644 .DS_Store create mode 100644 samples/gateway/node/.env.example create mode 100644 samples/gateway/node/README.md create mode 100644 samples/gateway/node/package-lock.json create mode 100644 samples/gateway/node/package.json create mode 100644 samples/gateway/node/server.js delete mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build delete mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect delete mode 100755 src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release create mode 100644 src/utils/parseFabloConfig.test.ts delete mode 100644 test-output.txt diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..47ebe4e7c27facc40cf842f489774b8eefb01b5d GIT binary patch literal 6148 zcmeHK%SyvQ6rE|SO({Ya3SADkE!c+&;wHrU14eYAQWH}&7&9eF&7u^t)*tdq{2uR} znSjNtMeMyWbMA8{b0G6zjB$4n4jHo7tD;G(asaj75td7;0+P&p+I2!lG(Qv%#i{;5^&=-f} z0&UQD0kmqfm4IytbdWXE6y@1U5~yn1O8%j6L}Rd$s{NDL4I!~ij{*$kL- z!Rl@{4YYbbTmFH`%-UoRnx z7$64z83VjE@g^=T%ABn~mWOApfOZcJ1@lT&KtNx+1b~72NKXZIT%Znlj=@qRj)Hzw Q4oDXPMF@4oz%MZH1!K!ed;kCd literal 0 HcmV?d00001 diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index bc1438f73..bce9c9ff8 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -31,3 +31,11 @@ jobs: yamllint -v npm install ./fablo-build.sh --push + + - name: Build and push node chaincode + run: | + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --tag "ghcr.io/fablo-io/fablo-kv-node-chaincode-sample:$FABLO_VERSION" \ + --push \ + samples/chaincodes/chaincode-kv-node diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 92995e5db..9df16bda2 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -3,7 +3,7 @@ name: Release on tag on: push: tags: - - 'v*.*.*' + - '*.*.*' jobs: release: @@ -53,7 +53,7 @@ jobs: - name: Create next development version PR run: | - ./bump_version.sh unstable + sh ./bump_version.sh unstable NEW_VERSION=$(jq -r '.version' <"$GITHUB_WORKSPACE/package.json") BRANCH_NAME="bump-version-to-$NEW_VERSION" git checkout -b $BRANCH_NAME diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index 1f908cc7e..db02f3be2 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -40,6 +40,7 @@ jobs: - name: Lint run: npm run lint && ./lint.sh + # test-k8: # needs: test-main # runs-on: ubuntu-latest @@ -172,10 +173,32 @@ jobs: test-05-v3: needs: test-main - runs-on: ubuntu-latest + runs-on: macos-15 steps: - name: Check out repository code uses: actions/checkout@v2 + + - name: Install Docker + Colima + run: | + brew update + brew install qemu colima docker + brew uninstall --ignore-dependencies lima + curl https://raw.githubusercontent.com/Homebrew/homebrew-core/45464b6c4788a80be3f131ab5e2a4468cdfa960c/Formula/l/lima.rb > lima.rb + brew install lima.rb + LIMACTL_PATH=$(brew --prefix)/bin/limactl + sudo curl -L -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/master/limactl + sudo chmod +x $LIMACTL_PATH + colima start --network-address --arch arm64 --vm-type=qemu + mkdir -p ~/.docker/cli-plugins + brew install docker-compose + ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose + + - name: Install dependencies + run: | + brew install shellcheck yamllint + npm install -g npm@latest + npm install + - name: Build Fablo run: | diff --git a/.gitignore b/.gitignore index 25d70bd35..52740672f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ node_modules .idea .vscode samples/invalid-fablo-config.json +.DS_Store \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d0bdbf2..ca99b58fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 2.3.0 + +### Features +* Hardcode fablo config inside init generator + [#554](https://github.com/hyperledger-labs/fablo/pull/554) +* Publish sample chaincode Docker image + [#555](https://github.com/hyperledger-labs/fablo/pull/555) +* Support installing Chaincode from Docker image using CCAAS + [#550](https://github.com/hyperledger-labs/fablo/pull/550) + + + ## 2.2.0 ### Features diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26616f9a1..f6be90af3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,7 +39,7 @@ See `git help commit`: - **Ent-to-End network tests**: Execute relevant shell scripts from `e2e-network` directory with E2E network tests. 3. **Update snapshots**: If you've made changes that affect snapshots (esp. any template changes), update them using `npm run test:e2e-update`. -## ## Running Fablo locally +## Running Fablo locally You may want to verify some changes by running Fablo locally. To do so: 1. Execute `./fablo-build.sh` script to create a Fablo Docker image locally. diff --git a/Dockerfile b/Dockerfile index 057d4a9bd..57c66d516 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ COPY package.json /fablo/package.json COPY package-lock.json /fablo/package-lock.json # copy files for init network -COPY samples/fablo-config-hlf2-1org-1chaincode.json /fablo/generators/init/templates/fablo-config.json COPY samples/chaincodes/chaincode-kv-node /fablo/generators/init/templates/chaincodes/chaincode-kv-node WORKDIR /fablo diff --git a/docs/schema.json b/docs/schema.json index 58386a986..f66d2aaae 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -421,7 +421,7 @@ "allOf": [ { "if": { - "properties": { "lang": { "const": "ccaas_builder"}} + "properties": { "lang": { "const": "ccaas"}} }, "then": { "required": [ "image"] @@ -452,7 +452,7 @@ "golang", "java", "node", - "ccaas_builder" + "ccaas" ] }, "channel": { diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 9e364a136..68ccbeb99 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -1,22 +1,22 @@ # Test cases -| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | -| ------------------------- |:---------------:|:-----------:|:----------:|:------------------------:|:------------------:|:---------------------:| -| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2 | 3.0.0-beta | 3.0.0-beta | -| TLS | no | yes | no | yes | yes | yes | -| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | -| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | -| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | -| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | -| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | -| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | -| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | -| Channels | 1 | 2 | 1 | 1 | 1 | 1 | -| Node chaincode | yes | yes | yes | yes | yes | yes | -| Node chaincode upgrade | no | yes | no | no | no | no | -| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | -| Private data | no | no | yes | yes | no | no | -| Java chaincode | no | yes | no | no | no | no | -| Go chaincode | no | no | no | no | no | no | -| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer | - | - | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | +| Test case | 01-simple | 02-raft | 03-private | 04-snapshot | test-05-version3 | test-05-version3-BFT | +| ------------------------- |:---------------:|:-----------:|:----------:|:----------------------------:|:------------------:|:---------------------:| +| Fabric versions | 2.4.7 | 2.3.2 | 2.4.7 | 2.3.3/2.4.2/2.5.12 | 3.0.0-beta | 3.0.0-beta | +| TLS | no | yes | no | yes | yes | yes | +| Channel capabilities | v2 | v2 | v2_5 | v2 | v3_0 | v3_0 | +| Consensus | solo | RAFT | solo | RAFT | RAFT | BFT | +| Orderer nodes | 1 | 3 | 1 | 1 | 3 | 4 | +| Organizations | 1 | 2 | 2 | 1 | 1 | 1 | +| CA database | SQLite | SQLite | SQLite | Postgres | SQLite | SQLite | +| Peer database | LevelDB | LevelDB | LevelDB | CouchDB | LevelDB | LevelDB | +| Peer count | 2 | 2, 2 | 2, 1 | 2 | 2 | 2 | +| Channels | 1 | 2 | 1 | 1 | 1 | 1 | +| Node chaincode | yes | yes | yes | yes | yes | yes | +| Node chaincode upgrade | no | yes | no | no | no | no | +| Node chaincode endorsement| OR | OR | OR, AND | default | OR | OR | +| Private data | no | no | yes | yes | no | no | +| Java chaincode | no | yes | no | no | no | no | +| Go chaincode | no | no | no | no | no | no | +| Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer, CCAAS | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e-network/docker/test-03-private-data.sh b/e2e-network/docker/test-03-private-data.sh index 027d1e427..139cf0f3d 100755 --- a/e2e-network/docker/test-03-private-data.sh +++ b/e2e-network/docker/test-03-private-data.sh @@ -89,18 +89,11 @@ expectInvoke "peer0.org2.example.com" "my-channel1" "or-policy-chaincode" \ 'tx creator does not have write access permission on privatedata in chaincodeName:or-policy-chaincode collectionName: org1-collection' \ '{"message":"Q29ycnVwdGVkIG1lc3NhZ2U="}' -# TODO to be added in https://github.com/hyperledger-labs/fablo/issues/466 -#expectInvoke "peer0.org1.example.com,peer0.org2.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:putPrivateMessage", "both-orgs-collection"]}' \ -# '{\"success\":\"OK\"}' \ -# '{"message":"RG9udCBjaGFuZ2UgbWUgcGx6"}' -#expectInvoke "peer0.org2.example.com,peer0.org1.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:getPrivateMessage", "both-orgs-collection"]}' \ -# 'tx creator does not have read access permission on privatedata in chaincodeName:and-policy-chaincode collectionName: org1-collection' -#expectInvoke "peer0.org2.example.com,peer0.org1.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:putPrivateMessage", "both-orgs-collection"]}' \ -# '{\"success\":\"OK\"}' \ -# '{"message":"QW5kIGFub3RoZXIgb25l"}' -#expectInvoke "peer0.org1.example.com,peer0.org2.example.com" "my-channel1" "and-policy-chaincode" \ -# '{"Args":["KVContract:getPrivateMessage", "both-orgs-collection"]}' \ -# 'Error: could not assemble transaction: ProposalResponsePayloads do not match' +# Org1 and Org2: Test chaincode with AND endorsement policy +expectInvoke "peer0.org2.example.com,peer0.org1.example.com" "my-channel1" "and-policy-chaincode" \ + '{"Args":["KVContract:putPrivateMessage", "both-orgs-collection"]}' \ + '{\"success\":\"OK\"}' \ + '{"message":"QW5kIGFub3RoZXIgb25l"}' +expectInvoke "peer0.org1.example.com,peer0.org2.example.com" "my-channel1" "and-policy-chaincode" \ + '{"Args":["KVContract:getPrivateMessage", "both-orgs-collection"]}' \ + '{\"success\":\"And another one\"}' diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index 33c6bcf1f..510268015 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -5,24 +5,12 @@ set -e TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." -REGISTRY_PORT=5000 -REGISTRY_NAME="fablo-test-case-ccaas" -CHAINCODE_IMAGE="localhost:$REGISTRY_PORT/fablo-test-case-ccaas:0.0.1" export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json" CHAINCODE_SRC="$FABLO_HOME/samples/chaincodes/chaincode-kv-node" -echo "Starting local registry on port $REGISTRY_PORT" -docker run -d -p "$REGISTRY_PORT:$REGISTRY_PORT" --restart=always --name $REGISTRY_NAME registry:2 || true - -echo "Building CCAAS chaincode image..." -docker build -t "$CHAINCODE_IMAGE" "$CHAINCODE_SRC" - -echo "Pushing chaincode image to local registry..." -docker push "$CHAINCODE_IMAGE" - networkUp() { "$FABLO_HOME/fablo-build.sh" (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up "$CONFIG") @@ -38,7 +26,6 @@ networkDown() { sleep 2 (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) - docker rm -f "$REGISTRY_NAME" || true } waitForContainer() { @@ -71,7 +58,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" -waitForContainer "chaincode1-peer0.org1.example.com" "Starting chaincode container from image" +waitForContainer "peer0.org1.example.com_chaincode1" "Bootstrap process completed" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 494b8ba45..f9b00a23c 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -335,7 +335,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1163,7 +1163,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1671,7 +1671,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1701,7 +1701,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1718,7 +1718,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1813,7 +1813,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1843,7 +1843,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1860,7 +1860,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1890,7 +1890,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "directory": undefined, "endorsement": undefined, - "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1902,7 +1902,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1932,7 +1932,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1949,7 +1949,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -1976,7 +1976,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, "lang": "ccaas", "name": "chaincode1", - "port": 7052, + "peerChaincodeInstances": [ + { + "containerName": "peer0.org1.example.com_chaincode1", + "peerAddress": "peer0.org1.example.com", + "port": 7052, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -1994,7 +2000,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2024,7 +2030,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2041,7 +2047,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2136,7 +2142,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2166,7 +2172,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2183,7 +2189,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2214,21 +2220,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j ], "global": { "capabilities": { - "application": "V2_0", + "application": "V2_5", "channel": "V2_0", "isV2": true, "isV3": false, "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "2.3.3", + "fabricBaseosVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.3.3", - "fabricJavaenvVersion": "2.3", - "fabricNodeenvVersion": "2.3", - "fabricRecommendedNodeVersion": "12", - "fabricToolsVersion": "2.3.3", - "fabricVersion": "2.3.3", + "fabricCcenvVersion": "2.5.12", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.12", + "fabricVersion": "2.5.12", "monitoring": { "loglevel": "info", }, @@ -2383,7 +2389,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2413,7 +2419,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2430,7 +2436,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -2857,7 +2863,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "or-policy-chaincode", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [ { "blockToLive": 0, @@ -3267,7 +3273,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-private-data. }, "lang": "node", "name": "and-policy-chaincode", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [ { "blockToLive": 0, @@ -4343,7 +4349,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -4792,7 +4798,7 @@ exports[`extend config samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] }, "lang": "java", "name": "chaincode2", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -6957,7 +6963,7 @@ exports[`extend config samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer. }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -9536,7 +9542,7 @@ exports[`extend config samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -10496,7 +10502,7 @@ exports[`extend config samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = }, "lang": "node", "name": "chaincode1", - "port": undefined, + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11103,7 +11109,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11133,7 +11139,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11150,7 +11156,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11245,7 +11251,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11275,7 +11281,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11292,7 +11298,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11322,7 +11328,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "directory": undefined, "endorsement": undefined, - "image": "localhost:5000/fablo-test-case-ccaas:0.0.1", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11334,7 +11340,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11364,7 +11370,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11381,7 +11387,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11408,7 +11414,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, "lang": "ccaas", "name": "chaincode1", - "port": 7052, + "peerChaincodeInstances": [ + { + "containerName": "peer0.org1.example.com_chaincode1", + "peerAddress": "peer0.org1.example.com", + "port": 7052, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11426,7 +11438,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11456,7 +11468,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11473,7 +11485,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11568,7 +11580,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11598,7 +11610,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11615,7 +11627,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11646,21 +11658,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "global": { "capabilities": { - "application": "V2_0", + "application": "V2_5", "channel": "V2_0", "isV2": true, "isV3": false, "orderer": "V2_0", }, "engine": "docker", - "fabricBaseosVersion": "2.3.3", + "fabricBaseosVersion": "2.5.12", "fabricCaVersion": "1.5.5", - "fabricCcenvVersion": "2.3.3", - "fabricJavaenvVersion": "2.3", - "fabricNodeenvVersion": "2.3", - "fabricRecommendedNodeVersion": "12", - "fabricToolsVersion": "2.3.3", - "fabricVersion": "2.3.3", + "fabricCcenvVersion": "2.5.12", + "fabricJavaenvVersion": "2.5", + "fabricNodeenvVersion": "2.5", + "fabricRecommendedNodeVersion": "16", + "fabricToolsVersion": "2.5.12", + "fabricVersion": "2.5.12", "monitoring": { "loglevel": "info", }, @@ -11815,7 +11827,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11845,7 +11857,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, @@ -11862,7 +11874,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "type": "CouchDb", }, "fullAddress": "peer0.org1.example.com:7041", - "gatewayEnabled": false, + "gatewayEnabled": true, "isAnchorPeer": true, "name": "peer0", "port": 7041, diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b79c8f74e..f83115f3a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3 +1,3368 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V2_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 1 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + Consortiums: + SampleConsortium: + Organizations: + - *Orderer + - *Org1 + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *ApplicationCapabilities + Consortium: SampleConsortium + Consortiums: + SampleConsortium: + Organizations: + - *Org1 + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 1 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Hyperledger Explorer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1", + "tlsEnable": true, + "enableAuthentication": true, + "adminCredential": { + "id": "admin", + "password": "adminpw" + }, + "connection": { + "timeout": { + "peer": { + "endorser": "300" + }, + "orderer": "300" + } + } + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "adminPrivateKey": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" + }, + "peers": [ + "peer0.org1.example.com" + ], + "signedCert": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" + } + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://peer0.org1.example.com:7041", + "tlsCACerts": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" + } + } + }, + "channels": { + "my-channel1": { + "peers": {} + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"FABLO_VERSION=2.2.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=info + +FABRIC_VERSION=2.5.12 +FABRIC_TOOLS_VERSION=2.5.12 +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=2.5.12 +FABRIC_BASEOS_VERSION=2.5.12 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + fi + + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating genesis block for group group1" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + fi +} + +runDevModeChaincode() { + local chaincodeName=$1 + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + local version="0.0.1" + printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + + fi +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + fi +} + +notifyOrgsAboutChannels() { + + printHeadline "Creating new channel config blocks" "U1F537" + createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" + + printHeadline "Notyfing orgs about channels" "U1F4E2" + notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + printHeadline "Deleting new channel config blocks" "U1F52A" + deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_DB_TLS_ENABLED=false + - FABRIC_CA_SERVER_DB_TYPE=postgres + - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + depends_on: + db.ca.org1.example.com: + condition: service_healthy + networks: + - basic + + db.ca.org1.example.com: + container_name: db.ca.org1.example.com + image: postgres:\${FABRIC_CA_POSTGRES_VERSION} + environment: + - POSTGRES_PASSWORD=caDbPass12345 + - POSTGRES_USER=postgres + - POSTGRES_DB=fabriccaserver + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + fablo-rest.org1.example.com: + container_name: fablo-rest.org1.example.com + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} + environment: + - PORT=8000 + - MSP_ID=Org1MSP + - FABRIC_CA_URL=https://ca.org1.example.com:7054 + - FABRIC_CA_NAME=ca.org1.example.com + - AS_LOCALHOST=false + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - HFC_LOGGING={"error":"console","warn":"console","info":"console"} + volumes: + # note: fablo needs access to all anchor peer certs + - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro + ports: + - 8801:8000 + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # CouchDB + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + depends_on: + couchdb.peer0.org1.example.com: + condition: service_healthy + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + couchdb.peer0.org1.example.com: + container_name: couchdb.peer0.org1.example.com + image: couchdb:\${COUCHDB_VERSION} + environment: + - COUCHDB_USER=peer0 + - COUCHDB_PASSWORD=peer0Password + healthcheck: + test: "curl -f http://localhost:5984/" + interval: 5s + timeout: 10s + retries: 7 + ports: + - 5100:5984 + networks: + - basic + + db.explorer.example.com: + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + container_name: db.explorer.example.com + environment: + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWORD=password + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + explorer.example.com: + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + restart: on-failure:8 + container_name: explorer.example.com + environment: + - DATABASE_HOST=db.explorer.example.com + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWD=password + - LOG_LEVEL_APP=debug + - LOG_LEVEL_DB=debug + - LOG_LEVEL_CONSOLE=info + - LOG_CONSOLE_STDOUT=true + - DISCOVERY_AS_LOCALHOST=false + volumes: + - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json + - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile + - ../fabric-config/crypto-config:/tmp/crypto + ports: + - "7010:8080" + depends_on: + db.explorer.example.com: + condition: service_healthy + networks: + - basic + + peer0.org1.example.com_chaincode1: + container_name: peer0.org1.example.com_chaincode1 + image: ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0 + pull_policy: always + environment: + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 + - CHAINCODE_ID=chaincode1:0.0.1 + ports: + - 7052:7052 + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx + peer channel join -b "\${CHANNEL_NAME}".block + + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + peer0.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + " +} + +__getCAPostgresNodes() { + echo " + db.ca.org1.example.com + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" + +perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ce77dfe03..da36e4563 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1509,26 +1509,20 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 fi - peerChaincodeInvoke "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" + peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" } " `; @@ -1541,8 +1535,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -1680,8 +1672,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1711,8 +1702,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1760,8 +1750,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "false" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" @@ -1983,6 +1972,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2027,6 +2018,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2431,54 +2424,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + echo "Packaging chaincode as CCAAS (external builder)..." - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 0bb466a84..267586c91 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2179,31 +2179,24 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" - fi - if [[ "$1" == *"peer0.org2.example.com"* ]]; then + if [[ "$1" == "peer0.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer0.org2.example.com:7061" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 fi - peerChaincodeInvoke "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" + peer_addresses="\${peer_addresses//peer0.org2.example.com/peer0.org2.example.com:7061}" + peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" } " `; @@ -2216,8 +2209,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -2397,8 +2388,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2415,8 +2405,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2449,8 +2438,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2469,8 +2457,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2533,8 +2520,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'or-policy-chaincode'" "U1F60E" chaincodeBuild "or-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" @@ -2553,8 +2539,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'and-policy-chaincode'" "U1F60E" chaincodeBuild "and-policy-chaincode" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" "" "" "false" - printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" @@ -2820,6 +2805,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2864,6 +2851,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2957,6 +2946,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -3361,54 +3352,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 636e12a37..91e26c7ff 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3111,58 +3111,43 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7061" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7062" - - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer0.org2.example.com"* ]]; then + if [[ "$1" == "peer0.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer0.org2.example.com:7081" - - peer_certs="$peer_certs,crypto/peers/peer0.org2.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org2.example.com"* ]]; then + if [[ "$1" == "peer1.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer1.org2.example.com:7082" + fi - peer_certs="$peer_certs,crypto/peers/peer1.org2.example.com/tls/ca.crt" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7061}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7062}" + peer_addresses="\${peer_addresses//peer0.org2.example.com/peer0.org2.example.com:7081}" + peer_addresses="\${peer_addresses//peer1.org2.example.com/peer1.org2.example.com:7082}" - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer0.org2.example.com/crypto/peers/peer0.org2.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org2.example.com/crypto/peers/peer1.org2.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer1.com-cert.pem" fi - if [ "$2" = "my-channel2" ]; then ca_cert="crypto-orderer/tlsca.orderer1.com-cert.pem" fi - if [ "$2" = "my-channel3" ]; then ca_cert="crypto-orderer/tlsca.orderer1.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -3175,8 +3160,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -3523,8 +3506,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3540,8 +3522,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" - printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3573,8 +3554,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3592,8 +3572,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" - printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -3655,8 +3634,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" @@ -3674,8 +3652,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple")" ]; then printHeadline "Packaging chaincode 'chaincode2'" "U1F60E" chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" - chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" "" "" "true" - printHeadline "Installing 'chaincode2' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" @@ -4159,6 +4136,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4208,6 +4187,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4317,6 +4298,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4366,6 +4349,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4770,54 +4755,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index be83549d6..e45a1c347 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3418,72 +3418,53 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" - - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer0.org2.example.com"* ]]; then + if [[ "$1" == "peer0.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer0.org2.example.com:7061" - - peer_certs="$peer_certs,crypto/peers/peer0.org2.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org2.example.com"* ]]; then + if [[ "$1" == "peer1.org2.example.com"* ]]; then cli="cli.org2.example.com" - peer_addresses="$peer_addresses,peer1.org2.example.com:7062" - - peer_certs="$peer_certs,crypto/peers/peer1.org2.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer0.org3.example.com"* ]]; then + if [[ "$1" == "peer0.org3.example.com"* ]]; then cli="cli.org3.example.com" - peer_addresses="$peer_addresses,peer0.org3.example.com:7081" - - peer_certs="$peer_certs,crypto/peers/peer0.org3.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org3.example.com"* ]]; then + if [[ "$1" == "peer1.org3.example.com"* ]]; then cli="cli.org3.example.com" - peer_addresses="$peer_addresses,peer1.org3.example.com:7082" - - peer_certs="$peer_certs,crypto/peers/peer1.org3.example.com/tls/ca.crt" - - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 fi + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" + peer_addresses="\${peer_addresses//peer0.org2.example.com/peer0.org2.example.com:7061}" + peer_addresses="\${peer_addresses//peer1.org2.example.com/peer1.org2.example.com:7062}" + peer_addresses="\${peer_addresses//peer0.org3.example.com/peer0.org3.example.com:7081}" + peer_addresses="\${peer_addresses//peer1.org3.example.com/peer1.org3.example.com:7082}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer0.org2.example.com/crypto/peers/peer0.org2.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org2.example.com/crypto/peers/peer1.org2.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer0.org3.example.com/crypto/peers/peer0.org3.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org3.example.com/crypto/peers/peer1.org3.example.com/tls/ca.crt}" + if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - if [ "$2" = "my-channel2" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - if [ "$2" = "my-channel3" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -3496,8 +3477,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -3861,8 +3840,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3892,8 +3870,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -3941,8 +3918,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "12" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -5279,54 +5255,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + echo "Packaging chaincode as CCAAS (external builder)..." - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index da1c8ff76..b44b127d3 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1585,36 +1585,27 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + fi - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -1627,8 +1618,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -1768,8 +1757,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1799,8 +1787,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1836,8 +1823,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2222,6 +2208,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2271,6 +2259,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2681,54 +2671,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 2655c37cd..383666036 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1610,36 +1610,27 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - peer_certs="" - - if [[ "$1" == *"peer0.org1.example.com"* ]]; then + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer0.org1.example.com:7041" - - peer_certs="$peer_certs,crypto/peers/peer0.org1.example.com/tls/ca.crt" - fi - if [[ "$1" == *"peer1.org1.example.com"* ]]; then + if [[ "$1" == "peer1.org1.example.com"* ]]; then cli="cli.org1.example.com" - peer_addresses="$peer_addresses,peer1.org1.example.com:7042" + fi - peer_certs="$peer_certs,crypto/peers/peer1.org1.example.com/tls/ca.crt" + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" - fi - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" fi - - peerChaincodeInvokeTls "$cli" "\${peer_addresses:1}" "$2" "$3" "$4" "$5" "\${peer_certs:1}" "$ca_cert" - + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" } " `; @@ -1652,8 +1643,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp @@ -1792,8 +1781,7 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1823,8 +1811,7 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -1860,8 +1847,7 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" "" "" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" @@ -2246,6 +2232,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2295,6 +2283,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2705,54 +2695,63 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CHAINCODE_PORT=$7 - local TLS_ENABLED=$8 echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CHAINCODE_PORT: $CHAINCODE_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" - inputLog "TLS_ENABLED: $TLS_ENABLED" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} - local PACKAGE_DIR="./chaincode-packages/ccaas_$CHAINCODE_LABEL" - mkdir -p "$PACKAGE_DIR" +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 - echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"$CHAINCODE_NAME:$CHAINCODE_PORT\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + echo "Packaging chaincode as CCAAS (external builder)..." - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + mkdir -p "$PACKAGE_DIR/code" + echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 01450da29..452e4ca80 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2009,6 +2009,7 @@ Validation warnings count: 0 } } }, + "peerChaincodeInstances": [], "privateData": [] }, { @@ -2455,6 +2456,7 @@ Validation warnings count: 0 } } }, + "peerChaincodeInstances": [], "privateData": [] } ], @@ -2475,8 +2477,8 @@ Validation warnings count: 0 "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", "peerDevMode": false, + "engine": "docker", "fabricToolsVersion": "2.5.9", "fabricCaVersion": "1.5.5", "fabricCcenvVersion": "2.5.9", @@ -2969,20 +2971,26 @@ exports[`init should init simple fablo config 1`] = ` "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", - "peerDevMode": false + "peerDevMode": false, + "engine": "docker" }, "orgs": [ { "organization": { "name": "Orderer", - "domain": "orderer.example.com" + "domain": "orderer.example.com", + "mspName": "OrdererMSP" + }, + "ca": { + "prefix": "ca", + "db": "sqlite" }, "orderers": [ { "groupName": "group1", "type": "solo", - "instances": 1 + "instances": 1, + "prefix": "orderer" } ], "tools": {} @@ -2990,11 +2998,18 @@ exports[`init should init simple fablo config 1`] = ` { "organization": { "name": "Org1", - "domain": "org1.example.com" + "domain": "org1.example.com", + "mspName": "Org1MSP" }, + "ca": { + "prefix": "ca", + "db": "sqlite" + }, + "orderers": [], "peer": { "instances": 2, - "db": "LevelDb" + "db": "LevelDb", + "prefix": "peer" }, "tools": {} } @@ -3013,7 +3028,8 @@ exports[`init should init simple fablo config 1`] = ` ] } ], - "chaincodes": [] + "chaincodes": [], + "hooks": {} }" `; @@ -3023,20 +3039,26 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", - "peerDevMode": false + "peerDevMode": false, + "engine": "docker" }, "orgs": [ { "organization": { "name": "Orderer", - "domain": "orderer.example.com" + "domain": "orderer.example.com", + "mspName": "OrdererMSP" + }, + "ca": { + "prefix": "ca", + "db": "sqlite" }, "orderers": [ { "groupName": "group1", "type": "solo", - "instances": 1 + "instances": 1, + "prefix": "orderer" } ], "tools": {} @@ -3044,11 +3066,18 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` { "organization": { "name": "Org1", - "domain": "org1.example.com" + "domain": "org1.example.com", + "mspName": "Org1MSP" }, + "ca": { + "prefix": "ca", + "db": "sqlite" + }, + "orderers": [], "peer": { "instances": 2, - "db": "LevelDb" + "db": "LevelDb", + "prefix": "peer" }, "tools": {} } @@ -3073,9 +3102,11 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "version": "0.0.1", "lang": "node", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "directory": "./chaincodes/chaincode-kv-node", + "privateData": [] } - ] + ], + "hooks": {} }" `; @@ -3085,20 +3116,26 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "global": { "fabricVersion": "2.5.9", "tls": false, - "engine": "docker", - "peerDevMode": false + "peerDevMode": false, + "engine": "docker" }, "orgs": [ { "organization": { "name": "Orderer", - "domain": "orderer.example.com" + "domain": "orderer.example.com", + "mspName": "OrdererMSP" + }, + "ca": { + "prefix": "ca", + "db": "sqlite" }, "orderers": [ { "groupName": "group1", "type": "solo", - "instances": 1 + "instances": 1, + "prefix": "orderer" } ], "tools": { @@ -3108,11 +3145,18 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 { "organization": { "name": "Org1", - "domain": "org1.example.com" + "domain": "org1.example.com", + "mspName": "Org1MSP" }, + "ca": { + "prefix": "ca", + "db": "sqlite" + }, + "orderers": [], "peer": { "instances": 2, - "db": "LevelDb" + "db": "LevelDb", + "prefix": "peer" }, "tools": { "fabloRest": true @@ -3139,8 +3183,10 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "version": "0.0.1", "lang": "node", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "directory": "./chaincodes/chaincode-kv-node", + "privateData": [] } - ] + ], + "hooks": {} }" `; diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index d6b97b808..6cbed0b92 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -41,7 +41,6 @@ exports[`schema should match snapshot 1`] = ` "then": { "required": [ "image", - "port", ], }, }, diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 65a893d79..946f66015 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -28,6 +28,7 @@ describe("init", () => { expect(commandResult.output).toContain("Sample config file created! :)"); expect(commands.getFiles()).toEqual([ "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/.nvmrc", + "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/Dockerfile", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/index.js", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package-lock.json", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package.json", @@ -45,6 +46,7 @@ describe("init", () => { expect(commandResult.output).toContain("Sample config file created! :)"); expect(commands.getFiles()).toEqual([ "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/.nvmrc", + "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/Dockerfile", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/index.js", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package-lock.json", "e2e/__tmp__/commands-tests/chaincodes/chaincode-kv-node/package.json", diff --git a/e2e/schema.test.ts b/e2e/schema.test.ts index 2a2e7c9f4..af2df3611 100644 --- a/e2e/schema.test.ts +++ b/e2e/schema.test.ts @@ -257,7 +257,6 @@ describe("schema", () => { expect(withChaincodeLanguage("java")).toMatchSchema(schema); expect(withChaincodeLanguage("node")).toMatchSchema(schema); expect(withChaincodeLanguage("golang")).toMatchSchema(schema); - expect(withChaincodeLanguage("ccaas")).toMatchSchema(schema); expect(withChaincodeLanguage("cobol")).not.toMatchSchema(schema); }); diff --git a/samples/chaincodes/chaincode-kv-node/Dockerfile b/samples/chaincodes/chaincode-kv-node/Dockerfile index 8f6607602..9ebb6856b 100644 --- a/samples/chaincodes/chaincode-kv-node/Dockerfile +++ b/samples/chaincodes/chaincode-kv-node/Dockerfile @@ -9,4 +9,4 @@ COPY . . EXPOSE 7052 -CMD ["npm", "run", "start:ccaas"] \ No newline at end of file +CMD ["npm", "run", "start:ccaas"] diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index 58ef74226..4751eb2e3 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -8,13 +8,12 @@ }, "scripts": { "start": "fabric-chaincode-node start", - "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\" ", + "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\"", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", "lint": "eslint . --fix --ext .js" }, - "author": "SoftwareMill", "dependencies": { "fabric-contract-api": "2.4.2", "fabric-shim": "2.4.2" diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 23b8be15e..c07880f57 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -1,8 +1,11 @@ { - "$schema": "../docs/schema.json", + "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { - "fabricVersion": "2.3.3", - "tls": true + "fabricVersion": "2.5.12", + "tls": true, + "tools": { + "explorer": true + } }, "orgs": [ { @@ -29,6 +32,9 @@ "peer": { "instances": 1, "db": "CouchDb" + }, + "tools": { + "fabloRest": true } } ], @@ -49,9 +55,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas_builder", + "lang": "ccaas", "channel": "my-channel1", - "image": "localhost:5000/fablo-test-case-ccaas:0.0.1" + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" } ], "hooks": { diff --git a/samples/gateway/node/.env.example b/samples/gateway/node/.env.example new file mode 100644 index 000000000..ff878f4a7 --- /dev/null +++ b/samples/gateway/node/.env.example @@ -0,0 +1,9 @@ +CHANNEL_NAME=my-channel1 +CONTRACT_NAME=chaincode1 +PEER_GATEWAY_URL=localhost:7041 +PEER_ORG_NAME=peer0.org1.example.com +MSP_ID=Org1MSP +TLS_ROOT_CERT=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt +CREDENTIALS=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem +PRIVATE_KEY_PEM=../../../fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/keystore/priv-key.pem + diff --git a/samples/gateway/node/README.md b/samples/gateway/node/README.md new file mode 100644 index 000000000..84f94e7cd --- /dev/null +++ b/samples/gateway/node/README.md @@ -0,0 +1,25 @@ +# Purpose +To provide an example connection of Fablo with Node.js. + +# Pre-requisites +Docker + +Node >22 + +Git + +# Instructions +1. (If Fablo is not already installed) Clone the Fablo repo with `https://github.com/hyperledger-labs/fablo.git` and then `cd fablo`. +2. Start Docker. +3. Run `fablo up samples/fablo-config-hlf3-1orgs-1chaincode.json`. +4. Once Fablo is running, run `cd samples/gateway/node`. +5. Now install the Node server's dependencies with `npm i`. +6. Now let's copy the environment example to a usable file `cp .env.example .env`. +7. Start the node server with `node --env-file=.env server.js`. + +You should see a response like this: +``` +Put result: {"success":"OK"} +Get result: {"success":"2025-04-29T16:13:42.097Z"}` +``` + diff --git a/samples/gateway/node/package-lock.json b/samples/gateway/node/package-lock.json new file mode 100644 index 000000000..e035f749b --- /dev/null +++ b/samples/gateway/node/package-lock.json @@ -0,0 +1,429 @@ +{ + "name": "node", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "node", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@grpc/grpc-js": "^1.13.3", + "@hyperledger/fabric-gateway": "^1.7.1" + } + }, + "node_modules/@grpc/grpc-js": { + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.13.3.tgz", + "integrity": "sha512-FTXHdOoPbZrBjlVLHuKbDZnsTxXv2BlHF57xw6LuThXacXvtkahEPED0CKMk6obZDf65Hv4k3z62eyPNpvinIg==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.7.13", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.15.tgz", + "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@hyperledger/fabric-gateway": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@hyperledger/fabric-gateway/-/fabric-gateway-1.7.1.tgz", + "integrity": "sha512-NNd9YchCJx8u2/XIcDH8EEQeYOgje66JsNcjP/Q5GeIJVRUzlxFRn4I67Ro+Q9PUHihKE7+YPS5ydBrSgJSiMA==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/grpc-js": "^1.12.0", + "@hyperledger/fabric-protos": "^0.3.0", + "@noble/curves": "^1.7.0", + "google-protobuf": "^3.21.0" + }, + "engines": { + "node": ">=18.12.0" + }, + "optionalDependencies": { + "pkcs11js": "^2.1.0" + } + }, + "node_modules/@hyperledger/fabric-protos": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@hyperledger/fabric-protos/-/fabric-protos-0.3.7.tgz", + "integrity": "sha512-p69dVT+QKrL7OZOuWRrimopNUAQL+VpgVEovud5MGqHSMl20S5hZy0aWqmIW+qasRgJiHLNuU0T6xVfXJIeHKg==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/grpc-js": "^1.11.0", + "google-protobuf": "^3.21.0" + }, + "engines": { + "node": ">=16.13.0" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@noble/curves": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.0.tgz", + "integrity": "sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@types/node": { + "version": "22.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", + "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/google-protobuf": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.4.tgz", + "integrity": "sha512-MnG7N936zcKTco4Jd2PX2U96Kf9PxygAPKBug+74LHzmHXmceN16MmRcdgZv+DGef/S9YvQAfRsNCn4cjf9yyQ==", + "license": "(BSD-3-Clause AND Apache-2.0)" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/pkcs11js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/pkcs11js/-/pkcs11js-2.1.6.tgz", + "integrity": "sha512-+t5jxzB749q8GaEd1yNx3l98xYuaVK6WW/Vjg1Mk1Iy5bMu/A5W4O/9wZGrpOknWF6lFQSb12FXX+eSNxdriwA==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/PeculiarVentures" + } + }, + "node_modules/protobufjs": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.0.tgz", + "integrity": "sha512-Z2E/kOY1QjoMlCytmexzYfDm/w5fKAiRwpSzGtdnXW1zC88Z2yXazHHrOtwCzn+7wSxyE8PYM4rvVcMphF9sOA==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/samples/gateway/node/package.json b/samples/gateway/node/package.json new file mode 100644 index 000000000..26844aa21 --- /dev/null +++ b/samples/gateway/node/package.json @@ -0,0 +1,21 @@ +{ + "name": "node-fablo-gateway", + "version": "1.0.0", + "description": "", + "license": "ISC", + "author": "", + "main": "server.js", + "type": "module", + "engines" : { + "node" : ">=22" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "dependencies": { + "@grpc/grpc-js": "^1.13.3", + "@hyperledger/fabric-gateway": "^1.7.1" + } +} + diff --git a/samples/gateway/node/server.js b/samples/gateway/node/server.js new file mode 100644 index 000000000..97c731a2c --- /dev/null +++ b/samples/gateway/node/server.js @@ -0,0 +1,40 @@ +import * as grpc from '@grpc/grpc-js'; +import { connect, hash, signers } from '@hyperledger/fabric-gateway'; +import * as crypto from 'node:crypto'; +import { promises as fs } from 'node:fs'; +import { TextDecoder } from 'node:util'; + +const utf8Decoder = new TextDecoder(); + +async function connection() { + const credentials = await fs.readFile(process.env.CREDENTIALS); + const privateKeyPem = await fs.readFile(process.env.PRIVATE_KEY_PEM); + const privateKey = crypto.createPrivateKey(privateKeyPem); + const signer = signers.newPrivateKeySigner(privateKey); + const tlsRootCert = await fs.readFile( + process.env.TLS_ROOT_CERT, + ); + const client = new grpc.Client(process.env.PEER_GATEWAY_URL, grpc.credentials.createSsl(tlsRootCert), { + "grpc.ssl_target_name_override": process.env.PEER_ORG_NAME, + }); + const gateway = connect({ + identity: { mspId: process.env.MSP_ID, credentials }, + signer, + hash: hash.sha256, + client, + }); + try { + const network = gateway.getNetwork(process.env.CHANNEL_NAME); + const contract = network.getContract(process.env.CONTRACT_NAME); + const putResult = await contract.submitTransaction('put', 'time', new Date().toISOString()); + console.log('Put result:', utf8Decoder.decode(putResult)); + const getResult = await contract.evaluateTransaction('get', 'time'); + console.log('Get result:', utf8Decoder.decode(getResult)); + } finally { + gateway.close(); + client.close(); + } +} + +connection().catch(console.error); + diff --git a/src/init/index.ts b/src/init/index.ts index 000730544..52d90bd11 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -1,7 +1,77 @@ import * as Generator from "yeoman-generator"; import * as chalk from "chalk"; -import parseFabloConfig from "../utils/parseFabloConfig"; -import { GlobalJson } from "../types/FabloConfigJson"; +import { GlobalJson, FabloConfigJson } from "../types/FabloConfigJson"; + +function getDefaultFabloConfig(): FabloConfigJson { + return { + $schema: "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", + global: { + fabricVersion: "2.5.9", + tls: false, + peerDevMode: false, + }, + orgs: [ + { + organization: { + name: "Orderer", + domain: "orderer.example.com", + mspName: "OrdererMSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [ + { + groupName: "group1", + type: "solo", + instances: 1, + prefix: "orderer", + }, + ], + }, + { + organization: { + name: "Org1", + domain: "org1.example.com", + mspName: "Org1MSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [], + peer: { + instances: 2, + db: "LevelDb", + prefix: "peer", + }, + }, + ], + channels: [ + { + name: "my-channel1", + orgs: [ + { + name: "Org1", + peers: ["peer0", "peer1"], + }, + ], + }, + ], + chaincodes: [ + { + name: "chaincode1", + version: "0.0.1", + lang: "node", + channel: "my-channel1", + directory: "./chaincodes/chaincode-kv-node", + privateData: [], + }, + ], + hooks: {}, + }; +} export default class InitGenerator extends Generator { constructor(readonly args: string[], opts: Generator.GeneratorOptions) { @@ -9,7 +79,7 @@ export default class InitGenerator extends Generator { } async copySampleConfig(): Promise { - let fabloConfigJson = parseFabloConfig(this.fs.read(this.templatePath("fablo-config.json"))); + let fabloConfigJson = getDefaultFabloConfig(); const shouldInitWithNodeChaincode = this.args.length && this.args.find((v) => v === "node"); if (shouldInitWithNodeChaincode) { @@ -48,4 +118,4 @@ export default class InitGenerator extends Generator { console.log("==========================================================="); }); } -} +} \ No newline at end of file diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index bbd7ba2f8..86cc22f48 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -1,19 +1,58 @@ import { sortVersions, version } from "./repositoryUtils"; describe("repositoryUtils", () => { + it("should sort versions", () => { - // Given - const unsortedVersions = ["0.0.2", "0.0.2-unstable", "0.0.1", "0.1.11", "0.1.1", "0.1.1-unstable", "1.21.2"]; + const unsorted = [ + "0.0.2", + "0.0.2-unstable", + "0.0.1", + "0.1.11", + "0.1.1", + "0.1.1-unstable", + "1.21.2", + ]; + + const expected = [ + "1.21.2", + "0.1.11", + "0.1.1", + "0.0.2", + "0.0.1", + "0.1.1-unstable", + "0.0.2-unstable", + ]; + + expect(sortVersions(unsorted)).toEqual(expected); + }); - // When - const sortedVersions = sortVersions(unsortedVersions); + it("should place pre‑release (named) tags after the matching stable tag", () => { + const unsorted = [ + "0.1.1-alpha", + "0.1.1-beta", + "0.1.2-alpha", + "0.1.2", + "0.1.1", + ]; - // Then - const expectedVersions = ["1.21.2", "0.1.11", "0.1.1", "0.0.2", "0.0.1", "0.1.1-unstable", "0.0.2-unstable"]; + const expected = [ + "0.1.2", + "0.1.1", + "0.1.2-alpha", + "0.1.1-beta", + "0.1.1-alpha", + ]; - expect(sortedVersions).toEqual(expectedVersions); + expect(sortVersions(unsorted)).toEqual(expected); }); + it("should handle multi digit fragments correctly", () => { + const unsorted = ["1.9.9", "1.10.0", "1.9.10"]; + const expected = ["1.10.0", "1.9.10", "1.9.9"]; + expect(sortVersions(unsorted)).toEqual(expected); + }); + + it("should compare versions", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); @@ -24,4 +63,22 @@ describe("repositoryUtils", () => { expect(version("3.0.0").isGreaterOrEqual("3.0.0")).toBe(true); expect(version("3.0.0").isGreaterOrEqual("3.0.1")).toBe(false); }); + + it("should treat pre-release tags as equal to the corresponding stable tag for ≥ comparison", () => { + expect(version("0.0.1-alpha").isGreaterOrEqual("0.0.1")).toBe(true); + expect(version("0.0.1").isGreaterOrEqual("0.0.1-alpha")).toBe(true); + }); + + + it("should check membership with isOneOf()", () => { + const list = ["1.2.3", "2.0.0", "3.1.4-alpha"]; + expect(version("1.2.3").isOneOf(list)).toBe(true); + expect(version("3.1.4").isOneOf(list)).toBe(false); + }); + + + it("should take major.minor fragments only", () => { + expect(version("10.5.7").takeMajorMinor()).toBe("10.5"); + expect(version("2.0.0-beta").takeMajorMinor()).toBe("2.0"); + }); }); diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index e88a7804b..081ea4890 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -64,7 +64,6 @@ export default class SetupDockerGenerator extends Generator { // ======= fabric-docker =========================================================== this._copyDockerComposeEnv(global, orgs, composeNetworkName); this._copyDockerCompose(config); - this._copyBuildScripts(config); // ======= scripts ================================================================== this._copyCommandsGeneratedScript(config); @@ -179,24 +178,6 @@ export default class SetupDockerGenerator extends Generator { ); } - _copyBuildScripts(config: FabloConfigExtended): void { - this.fs.copyTpl( - this.templatePath("fabric-docker/ccaas_builder/bin/build"), - this.destinationPath("fabric-docker/ccaas_builder/bin/build"), - config, - ); - this.fs.copyTpl( - this.templatePath("fabric-docker/ccaas_builder/bin/detect"), - this.destinationPath("fabric-docker/ccaas_builder/bin/detect"), - config, - ); - this.fs.copyTpl( - this.templatePath("fabric-docker/ccaas_builder/bin/release"), - this.destinationPath("fabric-docker/ccaas_builder/bin/release"), - config, - ); - } - _copyCommandsGeneratedScript(config: FabloConfigExtended): void { this.fs.copyTpl( this.templatePath("fabric-docker/channel-query-scripts.sh"), diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build deleted file mode 100755 index 0c11107ef..000000000 --- a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/build +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -SOURCE=$1 -OUTPUT=$3 - -#external chaincodes expect connection.json file in the chaincode package -if [ ! -f "$SOURCE/connection.json" ]; then - >&2 echo "$SOURCE/connection.json not found" - exit 1 -fi - -#simply copy the endpoint information to specified output location -cp $SOURCE/connection.json $OUTPUT/connection.json - -if [ -d "$SOURCE/metadata" ]; then - cp -a $SOURCE/metadata $OUTPUT/metadata -fi - -exit 0 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect deleted file mode 100755 index 8b35fcc16..000000000 --- a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/detect +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -METADIR=$2 -#check if the "type" field is set to "external" -if [ "$(jq -r .type "$METADIR/metadata.json")" == "external" ]; then - exit 0 -fi - -exit 1 \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release b/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release deleted file mode 100755 index 3ef77ad9a..000000000 --- a/src/setup-docker/templates/fabric-docker/ccaas_builder/bin/release +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -CONFIG="${CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG:-{}}" -echo "Releasing chaincode using config: $CONFIG" >&2 - -mkdir -p /tmp/ccaas_extratct -tar -xzf code.tar.gz -C /tmp/ccaas_extratct - -cat /tmp/ccaas_extratct/connection.json \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh b/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh index ea1428885..3607d49cc 100755 --- a/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh +++ b/src/setup-docker/templates/fabric-docker/chaincode-scripts.sh @@ -31,34 +31,40 @@ chaincodeInvoke() { echo "Usage: fablo chaincode invoke [transient]" exit 1 fi - cli="" - peer_addresses="" - <% if (global.tls) { %> - peer_certs="" - <% } %> + + # Cli needs to be from the same org as the first peer <% orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - if [[ "$1" == *"<%= peer.address %>"* ]]; then + if [[ "$1" == "<%= peer.address %>"* ]]; then cli="<%= org.cli.address %>" - peer_addresses="$peer_addresses,<%= peer.fullAddress %>" - <% if(global.tls) { %> - peer_certs="$peer_certs,crypto/peers/<%= peer.address %>/tls/ca.crt" - <% } %> fi <% }) -%> <% }) -%> - if [ -z "$peer_addresses" ]; then - echo "Unknown peers: $1" - exit 1 - fi - <% if(!global.tls) { %> - peerChaincodeInvoke "$cli" "${peer_addresses:1}" "$2" "$3" "$4" "$5" - <% } else { %> - <% channels.forEach((channel) => { %> + + peer_addresses="$1" + <% orgs.forEach((org) => { -%> + <% org.peers.forEach((peer) => { -%> + peer_addresses="${peer_addresses//<%= peer.address %>/<%= peer.fullAddress %>}" + <% }) -%> + <% }) -%> + + <% if (global.tls) { -%> + peer_certs="$1" + <% orgs.forEach((org) => { -%> + <% org.peers.forEach((peer) => { -%> + peer_certs="${peer_certs//<%= peer.address %>/crypto/peers/<%= peer.address %>/tls/ca.crt}" + <% }) -%> + <% }) -%> + <% } -%> + + <% if(!global.tls) { -%> + peerChaincodeInvoke "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" + <% } else { -%> + <% channels.forEach((channel) => { -%> if [ "$2" = "<%= channel.name %>" ]; then ca_cert="crypto-orderer/tlsca.<%= ordererGroups[0].ordererHeads[0].domain %>-cert.pem" fi - <% }) %> - peerChaincodeInvokeTls "$cli" "${peer_addresses:1}" "$2" "$3" "$4" "$5" "${peer_certs:1}" "$ca_cert" - <% } %> + <% }) -%> + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" + <% } -%> } diff --git a/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh b/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh index 919f943b3..ab433dd44 100644 --- a/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh +++ b/src/setup-docker/templates/fabric-docker/channel-query-scripts.sh @@ -5,8 +5,6 @@ source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" set -eu channelQuery() { - echo "-> Channel query: " + "$@" - if [ "$#" -eq 1 ]; then printChannelsHelp <% orgs.forEach((org) => { org.peers.forEach((peer) => { %> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 464a46acf..83cd43ce5 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -8,9 +8,9 @@ - global */-%> printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" -<% if (chaincode.lang === 'ccaas_builder') { -%> +<% if (chaincode.lang === "ccaas") { -%> <% chaincode.peerChaincodeInstances.forEach((instance) => { -%> - chaincodePackage <% -%> + chaincodePackageCaas <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= instance.peerAddress %>" <% -%> "<%= chaincode.name %>" <% -%> @@ -35,9 +35,6 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= chaincode.name %>" <% -%> "$version" <% -%> "<%= chaincode.lang %>" <% -%> - "<%= chaincode.image || '' %>" <% -%> - "<%= chaincode.port || '' %>" <% -%> - "<%= global.tls %>" <% } -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 2f6c4dd60..d4524e82b 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,23 +1,7 @@ networks: basic: -services: -<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> - <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> - <%= instance.containerName %>: - container_name: <%= instance.containerName %> - image: <%= chaincode.image %> - pull_policy: always - environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> - - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> - ports: - - <%= instance.port %>:7052 - networks: - - basic - <% }) %> -<% } }) %> - +services: <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> @@ -259,7 +243,6 @@ services: container_name: <%= peer.address %> image: hyperledger/fabric-peer:${FABRIC_VERSION} environment: - - CORE_CHAINCODE_EXTERNALBUILDERS=[{"name":"external","path":"/opt/hyperledger/ccaas_builder","propagateEnvironment":["CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG"]}] - CORE_PEER_LOCALMSPID=<%= org.mspName %> - CORE_PEER_ID=<%= peer.address %> - CORE_PEER_ADDRESS=<%= peer.fullAddress %> @@ -303,7 +286,7 @@ services: # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG="{\"peername\":\"<%= peer.address %>\"}" + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"<%= peer.name %><%= org.name %>"} <%_ } _%> working_dir: /etc/hyperledger/fabric/peer/ command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> @@ -324,7 +307,6 @@ services: - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/peers/<%= peer.address %>/tls:/etc/hyperledger/fabric/peer/tls - ../fabric-config/crypto-config/peerOrganizations/<%= org.domain %>/users:/etc/hyperledger/fabric/peer/msp/users - ../fabric-config/config:/etc/hyperledger/fabric/config - - ./ccaas_builder:/opt/hyperledger/ccaas_builder networks: - basic <%_ if(peer.db.type==="CouchDb") { _%> @@ -391,3 +373,18 @@ services: networks: - basic <%_ } _%> +<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> + <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> + <%= instance.containerName %>: + container_name: <%= instance.containerName %> + image: <%= chaincode.image %> + pull_policy: always + environment: + - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> + - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + ports: + - <%= instance.port %>:7052 + networks: + - basic + <% }) %> +<% } }) %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 0ac8dce7c..1900939a1 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -87,6 +87,30 @@ chaincodePackage() { local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \ + --lang "$CHAINCODE_LANG" \ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCaas() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 local CHAINCODE_IMAGE=$6 local CONTAINER_PORT=$7 local CONTAINER_NAME=$8 @@ -95,54 +119,31 @@ chaincodePackage() { echo "Packaging chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" + + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" - if [ -n "$CHAINCODE_IMAGE" ]; then - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - mkdir -p "$PACKAGE_DIR" + mkdir -p "$PACKAGE_DIR/code" + echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" - echo "{\"type\":\"external\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - mkdir -p "$PACKAGE_DIR/code" - echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - - mkdir -p "./chaincode-packages" - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - if docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; then - echo "Successfully copied chaincode package to $CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - else - echo "Failed to copy chaincode package to container" >&2 - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - return 1 - fi + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; - # clean up - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - return - fi - - # Default to using the local chaincode directory - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \ - --lang "$CHAINCODE_LANG" \ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } chaincodeInstall() { diff --git a/src/utils/parseFabloConfig.test.ts b/src/utils/parseFabloConfig.test.ts new file mode 100644 index 000000000..77de1894a --- /dev/null +++ b/src/utils/parseFabloConfig.test.ts @@ -0,0 +1,149 @@ +import parseFabloConfig from "./parseFabloConfig"; + +describe("parseFabloConfig", () => { + it("should parse valid JSON config", () => { + const jsonConfig = `{ + "global": { + "fabricVersion": "2.5.9", + "tls": false, + "engine": "docker" + }, + "orgs": [ + { + "organization": { + "name": "Org1", + "domain": "org1.example.com" + } + } + ] + }`; + + const result = parseFabloConfig(jsonConfig); + + expect(result).toEqual({ + global: { + fabricVersion: "2.5.9", + tls: false, + engine: "docker" + }, + orgs: [ + { + organization: { + name: "Org1", + domain: "org1.example.com" + } + } + ] + }); + }); + + it("should parse valid YAML config", () => { + const yamlConfig = ` + global: + fabricVersion: "2.5.9" + tls: false + engine: docker + orgs: + - organization: + name: Org1 + domain: org1.example.com + `; + + const result = parseFabloConfig(yamlConfig); + + expect(result).toEqual({ + global: { + fabricVersion: "2.5.9", + tls: false, + engine: "docker" + }, + orgs: [ + { + organization: { + name: "Org1", + domain: "org1.example.com" + } + } + ] + }); + }); + + it("should parse complex YAML config with multiple orgs and channels", () => { + const yamlConfig = ` + global: + fabricVersion: "2.4.7" + tls: true + engine: kubernetes + orgs: + - organization: + name: Org1 + domain: org1.example.com + peers: + - name: peer0 + port: 7041 + - name: peer1 + port: 7042 + - organization: + name: Org2 + domain: org2.example.com + peers: + - name: peer0 + port: 8041 + channels: + - name: mychannel + orgs: ["Org1", "Org2"] + `; + + const result = parseFabloConfig(yamlConfig); + + expect(result).toEqual({ + global: { + fabricVersion: "2.4.7", + tls: true, + engine: "kubernetes" + }, + orgs: [ + { + organization: { + name: "Org1", + domain: "org1.example.com", + peers: [ + { + name: "peer0", + port: 7041 + }, + { + name: "peer1", + port: 7042 + } + ] + } + }, + { + organization: { + name: "Org2", + domain: "org2.example.com", + peers: [ + { + name: "peer0", + port: 8041 + } + ] + } + } + ], + channels: [ + { + name: "mychannel", + orgs: ["Org1", "Org2"] + } + ] + }); + }); + + it("should parse empty config", () => { + const emptyConfig = `{}`; + const result = parseFabloConfig(emptyConfig); + expect(result).toEqual({}); + }); +}); diff --git a/src/validate/index.ts b/src/validate/index.ts index cb9683b29..08b4d901e 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -1,5 +1,5 @@ import * as Generator from "yeoman-generator"; -// import { Validator as SchemaValidator } from "jsonschema"; +import { Validator as SchemaValidator } from "jsonschema"; import * as chalk from "chalk"; import * as config from "../config"; import parseFabloConfig from "../utils/parseFabloConfig"; @@ -91,7 +91,7 @@ class ValidateGenerator extends Generator { const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); this._validateFabricVersion(networkConfig.global); - // this._validateJsonSchema(networkConfig); + this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); this._validateEngineSpecificSettings(networkConfig); @@ -169,25 +169,25 @@ class ValidateGenerator extends Generator { } } - // _validateJsonSchema(configToValidate: FabloConfigJson) { - // const validator = new SchemaValidator(); - // const results = validator.validate(configToValidate, config.schema); - // results.errors.forEach((result) => { - // const msg = `${result.property} : ${result.message}`; - // const objectToEmit = { - // category: validationCategories.VALIDATION, - // message: msg, - // }; - // this.emit(validationErrorType.ERROR, objectToEmit); - // }); - // if (results.errors.length > 0) { - // const objectToEmit = { - // category: validationCategories.CRITICAL, - // message: "Json schema validation failed!", - // }; - // this.emit(validationErrorType.CRITICAL, objectToEmit); - // } - // } + _validateJsonSchema(configToValidate: FabloConfigJson) { + const validator = new SchemaValidator(); + const results = validator.validate(configToValidate, config.schema); + results.errors.forEach((result) => { + const msg = `${result.property} : ${result.message}`; + const objectToEmit = { + category: validationCategories.VALIDATION, + message: msg, + }; + this.emit(validationErrorType.ERROR, objectToEmit); + }); + if (results.errors.length > 0) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: "Json schema validation failed!", + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } _printIfNotEmpty(messages: Message[], caption: string) { if (messages.length > 0) { diff --git a/test-output.txt b/test-output.txt deleted file mode 100644 index 218c52003..000000000 --- a/test-output.txt +++ /dev/null @@ -1,64 +0,0 @@ - -> generator-fablo@2.2.0 test:e2e-update -> ./fablo-build.sh && jest e2e --runInBand --updateSnapshot && ./lint.sh - -allexport off -braceexpand on -emacs off -errexit on -errtrace off -functrace off -hashall on -histexpand off -history off -ignoreeof off -interactive-comments on -keyword off -monitor off -noclobber off -noexec off -noglob off -nolog off -notify off -nounset on -onecmd off -physical off -pipefail off -posix off -privileged off -verbose off -vi off -xtrace off -Building new image... - FABLO_HOME: /Users/artisan/Documents/workwith/opensource/fablo - FABLO_VERSION: 2.2.0 - VERSION_DETAILS: 2025-05-12-10:46:36-9154382 -Found '/Users/artisan/Documents/workwith/opensource/fablo/.nvmrc' with version <18> -Now using node v18.20.8 (npm v10.8.2) - -up to date, audited 1194 packages in 4s - -154 packages are looking for funding - run `npm fund` for details - -11 moderate severity vulnerabilities - -To address issues that do not require attention, run: - npm audit fix - -To address all issues (including breaking changes), run: - npm audit fix --force - -Run `npm audit` for details. - -> generator-fablo@2.2.0 build:dist -> npm run clean && tsc -p tsconfig-dist.json && npm run copydeps - - -> generator-fablo@2.2.0 clean -> rimraf generators - - -> generator-fablo@2.2.0 copydeps -> copyfiles --all --up 1 'src/*/templates/**' generators - From 7ee63ee09e0184626dbdb8589bb5a68e4dac4160 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Thu, 5 Jun 2025 05:46:40 -0500 Subject: [PATCH 304/471] use lang in type for metadata.json Signed-off-by: Real-Artisan Signed-off-by: Pereowei Daniel --- docs/schema.json | 2 +- samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index f66d2aaae..f2ddfc612 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -418,7 +418,7 @@ "lang", "channel" ], - "allOf": [ + "oneOf": [ { "if": { "properties": { "lang": { "const": "ccaas"}} diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index c07880f57..71969cf3d 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -55,9 +55,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas", + "lang": "node", "channel": "my-channel1", - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" + "directory": "./chaincodes/chaincode-kv-node" } ], "hooks": { From 8b439dedf4644a1997431d6af71cf1dfc66c180f Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Fri, 6 Jun 2025 08:24:20 -0500 Subject: [PATCH 305/471] change fabric version Signed-off-by: Real-Artisan Signed-off-by: Pereowei Daniel --- docs/schema.json | 2 +- e2e-network/docker/test-04-snapshot.sh | 2 +- .../templates/fabric-docker/core.yaml | 777 ++++++++++++++++++ 3 files changed, 779 insertions(+), 2 deletions(-) create mode 100644 src/setup-docker/templates/fabric-docker/core.yaml diff --git a/docs/schema.json b/docs/schema.json index f2ddfc612..f66d2aaae 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -418,7 +418,7 @@ "lang", "channel" ], - "oneOf": [ + "allOf": [ { "if": { "properties": { "lang": { "const": "ccaas"}} diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index 510268015..b853dc42c 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -58,7 +58,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" -waitForContainer "peer0.org1.example.com_chaincode1" "Bootstrap process completed" +# waitForContainer "chaincode1_peer0.org1.example.com" "Bootstrap process completed" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" diff --git a/src/setup-docker/templates/fabric-docker/core.yaml b/src/setup-docker/templates/fabric-docker/core.yaml new file mode 100644 index 000000000..7c3148143 --- /dev/null +++ b/src/setup-docker/templates/fabric-docker/core.yaml @@ -0,0 +1,777 @@ +# Copyright IBM Corp. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################### +# +# Peer section +# +############################################################################### +peer: + + # The peer id provides a name for this peer instance and is used when + # naming docker resources. + id: jdoe + + # The networkId allows for logical separation of networks and is used when + # naming docker resources. + networkId: dev + + # The Address at local network interface this Peer will listen on. + # By default, it will listen on all network interfaces + listenAddress: 0.0.0.0:7051 + + # The endpoint this peer uses to listen for inbound chaincode connections. + # If this is commented-out, the listen address is selected to be + # the peer's address (see below) with port 7052 + # chaincodeListenAddress: 0.0.0.0:7052 + + # The endpoint the chaincode for this peer uses to connect to the peer. + # If this is not specified, the chaincodeListenAddress address is selected. + # And if chaincodeListenAddress is not specified, address is selected from + # peer address (see below). If specified peer address is invalid then it + # will fallback to the auto detected IP (local IP) regardless of the peer + # addressAutoDetect value. + # chaincodeAddress: 0.0.0.0:7052 + + # When used as peer config, this represents the endpoint to other peers + # in the same organization. For peers in other organization, see + # gossip.externalEndpoint for more info. + # When used as CLI config, this means the peer's endpoint to interact with + address: 0.0.0.0:7051 + + # Whether the Peer should programmatically determine its address + # This case is useful for docker containers. + # When set to true, will override peer address. + addressAutoDetect: false + + # Settings for the Peer's gateway server. + gateway: + # Whether the gateway is enabled for this Peer. + enabled: true + # endorsementTimeout is the duration the gateway waits for a response + # from other endorsing peers before returning a timeout error to the client. + endorsementTimeout: 30s + # dialTimeout is the duration the gateway waits for a connection + # to other network nodes. + dialTimeout: 2m + + + # Keepalive settings for peer server and clients + keepalive: + # Interval is the duration after which if the server does not see + # any activity from the client it pings the client to see if it's alive + interval: 7200s + # Timeout is the duration the server waits for a response + # from the client after sending a ping before closing the connection + timeout: 20s + # MinInterval is the minimum permitted time between client pings. + # If clients send pings more frequently, the peer server will + # disconnect them + minInterval: 60s + # Client keepalive settings for communicating with other peer nodes + client: + # Interval is the time between pings to peer nodes. This must + # greater than or equal to the minInterval specified by peer + # nodes + interval: 60s + # Timeout is the duration the client waits for a response from + # peer nodes before closing the connection + timeout: 20s + # DeliveryClient keepalive settings for communication with ordering + # nodes. + deliveryClient: + # Interval is the time between pings to ordering nodes. This must + # greater than or equal to the minInterval specified by ordering + # nodes. + interval: 60s + # Timeout is the duration the client waits for a response from + # ordering nodes before closing the connection + timeout: 20s + + + # Gossip related configuration + gossip: + # Bootstrap set to initialize gossip with. + # This is a list of other peers that this peer reaches out to at startup. + # Important: The endpoints here have to be endpoints of peers in the same + # organization, because the peer would refuse connecting to these endpoints + # unless they are in the same organization as the peer. + bootstrap: 127.0.0.1:7051 + + # NOTE: orgLeader and useLeaderElection parameters are mutual exclusive. + # Setting both to true would result in the termination of the peer + # since this is undefined state. If the peers are configured with + # useLeaderElection=false, make sure there is at least 1 peer in the + # organization that its orgLeader is set to true. + + # Defines whenever peer will initialize dynamic algorithm for + # "leader" selection, where leader is the peer to establish + # connection with ordering service and use delivery protocol + # to pull ledger blocks from ordering service. + useLeaderElection: false + # Statically defines peer to be an organization "leader", + # where this means that current peer will maintain connection + # with ordering service and disseminate block across peers in + # its own organization. Multiple peers or all peers in an organization + # may be configured as org leaders, so that they all pull + # blocks directly from ordering service. + orgLeader: true + + # Interval for membershipTracker polling + membershipTrackerInterval: 5s + + # Overrides the endpoint that the peer publishes to peers + # in its organization. For peers in foreign organizations + # see 'externalEndpoint' + endpoint: + # Maximum count of blocks stored in memory + maxBlockCountToStore: 10 + # Max time between consecutive message pushes(unit: millisecond) + maxPropagationBurstLatency: 10ms + # Max number of messages stored until a push is triggered to remote peers + maxPropagationBurstSize: 10 + # Number of times a message is pushed to remote peers + propagateIterations: 1 + # Number of peers selected to push messages to + propagatePeerNum: 3 + # Determines frequency of pull phases(unit: second) + # Must be greater than digestWaitTime + responseWaitTime + pullInterval: 4s + # Number of peers to pull from + pullPeerNum: 3 + # Determines frequency of pulling state info messages from peers(unit: second) + requestStateInfoInterval: 4s + # Determines frequency of pushing state info messages to peers(unit: second) + publishStateInfoInterval: 4s + # Maximum time a stateInfo message is kept until expired + stateInfoRetentionInterval: + # Time from startup certificates are included in Alive messages(unit: second) + publishCertPeriod: 10s + # Should we skip verifying block messages or not (currently not in use) + skipBlockVerification: false + # Dial timeout(unit: second) + dialTimeout: 3s + # Connection timeout(unit: second) + connTimeout: 2s + # Buffer size of received messages + recvBuffSize: 20 + # Buffer size of sending messages + sendBuffSize: 200 + # Time to wait before pull engine processes incoming digests (unit: second) + # Should be slightly smaller than requestWaitTime + digestWaitTime: 1s + # Time to wait before pull engine removes incoming nonce (unit: milliseconds) + # Should be slightly bigger than digestWaitTime + requestWaitTime: 1500ms + # Time to wait before pull engine ends pull (unit: second) + responseWaitTime: 2s + # Alive check interval(unit: second) + aliveTimeInterval: 5s + # Alive expiration timeout(unit: second) + aliveExpirationTimeout: 25s + # Reconnect interval(unit: second) + reconnectInterval: 25s + # Max number of attempts to connect to a peer + maxConnectionAttempts: 120 + # Message expiration factor for alive messages + msgExpirationFactor: 20 + # This is an endpoint that is published to peers outside of the organization. + # If this isn't set, the peer will not be known to other organizations. + externalEndpoint: + # Leader election service configuration + election: + # Longest time peer waits for stable membership during leader election startup (unit: second) + startupGracePeriod: 15s + # Interval gossip membership samples to check its stability (unit: second) + membershipSampleInterval: 1s + # Time passes since last declaration message before peer decides to perform leader election (unit: second) + leaderAliveThreshold: 10s + # Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second) + leaderElectionDuration: 5s + + pvtData: + # pullRetryThreshold determines the maximum duration of time private data corresponding for a given block + # would be attempted to be pulled from peers until the block would be committed without the private data + pullRetryThreshold: 60s + # As private data enters the transient store, it is associated with the peer's ledger's height at that time. + # transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit, + # and the private data residing inside the transient store that is guaranteed not to be purged. + # Private data is purged from the transient store when blocks with sequences that are multiples + # of transientstoreMaxBlockRetention are committed. + transientstoreMaxBlockRetention: 1000 + # pushAckTimeout is the maximum time to wait for an acknowledgement from each peer + # at private data push at endorsement time. + pushAckTimeout: 3s + # Block to live pulling margin, used as a buffer + # to prevent peer from trying to pull private data + # from peers that is soon to be purged in next N blocks. + # This helps a newly joined peer catch up to current + # blockchain height quicker. + btlPullMargin: 10 + # the process of reconciliation is done in an endless loop, while in each iteration reconciler tries to + # pull from the other peers the most recent missing blocks with a maximum batch size limitation. + # reconcileBatchSize determines the maximum batch size of missing private data that will be reconciled in a + # single iteration. + reconcileBatchSize: 10 + # reconcileSleepInterval determines the time reconciler sleeps from end of an iteration until the beginning + # of the next reconciliation iteration. + reconcileSleepInterval: 1m + # reconciliationEnabled is a flag that indicates whether private data reconciliation is enable or not. + reconciliationEnabled: true + # skipPullingInvalidTransactionsDuringCommit is a flag that indicates whether pulling of invalid + # transaction's private data from other peers need to be skipped during the commit time and pulled + # only through reconciler. + skipPullingInvalidTransactionsDuringCommit: false + # implicitCollectionDisseminationPolicy specifies the dissemination policy for the peer's own implicit collection. + # When a peer endorses a proposal that writes to its own implicit collection, below values override the default values + # for disseminating private data. + # Note that it is applicable to all channels the peer has joined. The implication is that requiredPeerCount has to + # be smaller than the number of peers in a channel that has the lowest numbers of peers from the organization. + implicitCollectionDisseminationPolicy: + # requiredPeerCount defines the minimum number of eligible peers to which the peer must successfully + # disseminate private data for its own implicit collection during endorsement. Default value is 0. + requiredPeerCount: 0 + # maxPeerCount defines the maximum number of eligible peers to which the peer will attempt to + # disseminate private data for its own implicit collection during endorsement. Default value is 1. + maxPeerCount: 1 + + # Gossip state transfer related configuration + state: + # indicates whenever state transfer is enabled or not + # default value is false, i.e. state transfer is active + # and takes care to sync up missing blocks allowing + # lagging peer to catch up to speed with rest network. + # Keep in mind that when peer.gossip.useLeaderElection is true + # and there are several peers in the organization, + # or peer.gossip.useLeaderElection is false alongside with + # peer.gossip.orgleader being false, the peer's ledger may lag behind + # the rest of the peers and will never catch up due to state transfer + # being disabled. + enabled: false + # checkInterval interval to check whether peer is lagging behind enough to + # request blocks via state transfer from another peer. + checkInterval: 10s + # responseTimeout amount of time to wait for state transfer response from + # other peers + responseTimeout: 3s + # batchSize the number of blocks to request via state transfer from another peer + batchSize: 10 + # blockBufferSize reflects the size of the re-ordering buffer + # which captures blocks and takes care to deliver them in order + # down to the ledger layer. The actual buffer size is bounded between + # 0 and 2*blockBufferSize, each channel maintains its own buffer + blockBufferSize: 20 + # maxRetries maximum number of re-tries to ask + # for single state transfer request + maxRetries: 3 + + # TLS Settings + tls: + # Require server-side TLS + enabled: false + # Require client certificates / mutual TLS for inbound connections. + # Note that clients that are not configured to use a certificate will + # fail to connect to the peer. + clientAuthRequired: false + # X.509 certificate used for TLS server + cert: + file: tls/server.crt + # Private key used for TLS server + key: + file: tls/server.key + # rootcert.file represents the trusted root certificate chain used for verifying certificates + # of other nodes during outbound connections. + # It is not required to be set, but can be used to augment the set of TLS CA certificates + # available from the MSPs of each channel’s configuration. + rootcert: + file: tls/ca.crt + # If mutual TLS is enabled, clientRootCAs.files contains a list of additional root certificates + # used for verifying certificates of client connections. + # It augments the set of TLS CA certificates available from the MSPs of each channel’s configuration. + # Minimally, set your organization's TLS CA root certificate so that the peer can receive join channel requests. + clientRootCAs: + files: + - tls/ca.crt + # Private key used for TLS when making client connections. + # If not set, peer.tls.key.file will be used instead + clientKey: + file: + # X.509 certificate used for TLS when making client connections. + # If not set, peer.tls.cert.file will be used instead + clientCert: + file: + + # Authentication contains configuration parameters related to authenticating + # client messages + authentication: + # the acceptable difference between the current server time and the + # client's time as specified in a client request message + timewindow: 15m + + # Path on the file system where peer will store data (eg ledger). This + # location must be access control protected to prevent unintended + # modification that might corrupt the peer operations. + fileSystemPath: /var/hyperledger/production + + # BCCSP (Blockchain crypto provider): Select which crypto implementation or + # library to use + BCCSP: + Default: SW + # Settings for the SW crypto provider (i.e. when DEFAULT: SW) + SW: + # TODO: The default Hash and Security level needs refactoring to be + # fully configurable. Changing these defaults requires coordination + # SHA2 is hardcoded in several places, not only BCCSP + Hash: SHA2 + Security: 256 + # Location of Key Store + FileKeyStore: + # If "", defaults to 'mspConfigPath'/keystore + KeyStore: + # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11) + PKCS11: + # Location of the PKCS11 module library + Library: + # Token Label + Label: + # User PIN + Pin: + Hash: + Security: + + # Path on the file system where peer will find MSP local configurations + mspConfigPath: msp + # Identifier of the local MSP + # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!---- + # Deployers need to change the value of the localMspId string. + # In particular, the name of the local MSP ID of a peer needs + # to match the name of one of the MSPs in each of the channel + # that this peer is a member of. Otherwise this peer's messages + # will not be identified as valid by other nodes. + localMspId: SampleOrg + + # CLI common client config options + client: + # connection timeout + connTimeout: 3s + + # Delivery service related config + deliveryclient: + # Enables this peer to disseminate blocks it pulled from the ordering service + # via gossip. + # Note that 'gossip.state.enabled' controls point to point block replication + # of blocks committed in the past. + blockGossipEnabled: true + # It sets the total time the delivery service may spend in reconnection + # attempts until its retry logic gives up and returns an error + reconnectTotalTimeThreshold: 3600s + + # It sets the delivery service <-> ordering service node connection timeout + connTimeout: 3s + + # It sets the delivery service maximal delay between consecutive retries + reConnectBackoffThreshold: 3600s + + # A list of orderer endpoint addresses which should be overridden + # when found in channel configurations. + addressOverrides: + # - from: + # to: + # caCertsFile: + # - from: + # to: + # caCertsFile: + + # Type for the local MSP - by default it's of type bccsp + localMspType: bccsp + + # Used with Go profiling tools only in none production environment. In + # production, it should be disabled (eg enabled: false) + profile: + enabled: false + listenAddress: 0.0.0.0:6060 + + # Handlers defines custom handlers that can filter and mutate + # objects passing within the peer, such as: + # Auth filter - reject or forward proposals from clients + # Decorators - append or mutate the chaincode input passed to the chaincode + # Endorsers - Custom signing over proposal response payload and its mutation + # Valid handler definition contains: + # - A name which is a factory method name defined in + # core/handlers/library/library.go for statically compiled handlers + # - library path to shared object binary for pluggable filters + # Auth filters and decorators are chained and executed in the order that + # they are defined. For example: + # authFilters: + # - + # name: FilterOne + # library: /opt/lib/filter.so + # - + # name: FilterTwo + # decorators: + # - + # name: DecoratorOne + # - + # name: DecoratorTwo + # library: /opt/lib/decorator.so + # Endorsers are configured as a map that its keys are the endorsement system chaincodes that are being overridden. + # Below is an example that overrides the default ESCC and uses an endorsement plugin that has the same functionality + # as the default ESCC. + # If the 'library' property is missing, the name is used as the constructor method in the builtin library similar + # to auth filters and decorators. + # endorsers: + # escc: + # name: DefaultESCC + # library: /etc/hyperledger/fabric/plugin/escc.so + handlers: + authFilters: + - + name: DefaultAuth + - + name: ExpirationCheck # This filter checks identity x509 certificate expiration + decorators: + - + name: DefaultDecorator + endorsers: + escc: + name: DefaultEndorsement + library: + validators: + vscc: + name: DefaultValidation + library: + + # library: /etc/hyperledger/fabric/plugin/escc.so + # Number of goroutines that will execute transaction validation in parallel. + # By default, the peer chooses the number of CPUs on the machine. Set this + # variable to override that choice. + # NOTE: overriding this value might negatively influence the performance of + # the peer so please change this value only if you know what you're doing + validatorPoolSize: + + # The discovery service is used by clients to query information about peers, + # such as - which peers have joined a certain channel, what is the latest + # channel config, and most importantly - given a chaincode and a channel, + # what possible sets of peers satisfy the endorsement policy. + discovery: + enabled: true + # Whether the authentication cache is enabled or not. + authCacheEnabled: true + # The maximum size of the cache, after which a purge takes place + authCacheMaxSize: 1000 + # The proportion (0 to 1) of entries that remain in the cache after the cache is purged due to overpopulation + authCachePurgeRetentionRatio: 0.75 + # Whether to allow non-admins to perform non channel scoped queries. + # When this is false, it means that only peer admins can perform non channel scoped queries. + orgMembersAllowedAccess: false + + # Limits is used to configure some internal resource limits. + limits: + # Concurrency limits the number of concurrently running requests to a service on each peer. + # Currently this option is only applied to endorser service and deliver service. + # When the property is missing or the value is 0, the concurrency limit is disabled for the service. + concurrency: + # endorserService limits concurrent requests to endorser service that handles chaincode deployment, query and invocation, + # including both user chaincodes and system chaincodes. + endorserService: 2500 + # deliverService limits concurrent event listeners registered to deliver service for blocks and transaction events. + deliverService: 2500 + + # Since all nodes should be consistent it is recommended to keep + # the default value of 100MB for MaxRecvMsgSize & MaxSendMsgSize + # Max message size in bytes GRPC server and client can receive + maxRecvMsgSize: 104857600 + # Max message size in bytes GRPC server and client can send + maxSendMsgSize: 104857600 + +############################################################################### +# +# VM section +# +############################################################################### +vm: + + # Endpoint of the vm management system. For docker can be one of the following in general + # unix:///var/run/docker.sock + # http://localhost:2375 + # https://localhost:2376 + # If you utilize external chaincode builders and don't need the default Docker chaincode builder, + # the endpoint should be unconfigured so that the peer's Docker health checker doesn't get registered. + endpoint: unix:///var/run/docker.sock + + # settings for docker vms + docker: + tls: + enabled: false + ca: + file: docker/ca.crt + cert: + file: docker/tls.crt + key: + file: docker/tls.key + + # Enables/disables the standard out/err from chaincode containers for + # debugging purposes + attachStdout: false + + # Parameters on creating docker container. + # Container may be efficiently created using ipam & dns-server for cluster + # NetworkMode - sets the networking mode for the container. Supported + # standard values are: `host`(default),`bridge`,`ipvlan`,`none`. + # Dns - a list of DNS servers for the container to use. + # Note: `Privileged` `Binds` `Links` and `PortBindings` properties of + # Docker Host Config are not supported and will not be used if set. + # LogConfig - sets the logging driver (Type) and related options + # (Config) for Docker. For more info, + # https://docs.docker.com/engine/admin/logging/overview/ + # Note: Set LogConfig using Environment Variables is not supported. + hostConfig: + NetworkMode: host + Dns: + # - 192.168.0.1 + LogConfig: + Type: json-file + Config: + max-size: "50m" + max-file: "5" + Memory: 2147483648 + +############################################################################### +# +# Chaincode section +# +############################################################################### +chaincode: + + # The id is used by the Chaincode stub to register the executing Chaincode + # ID with the Peer and is generally supplied through ENV variables + # the `path` form of ID is provided when installing the chaincode. + # The `name` is used for all other requests and can be any string. + id: + path: + name: + + # Generic builder environment, suitable for most chaincode types + builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION) + + # Enables/disables force pulling of the base docker images (listed below) + # during user chaincode instantiation. + # Useful when using moving image tags (such as :latest) + pull: false + + golang: + # golang will never need more than baseos + runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION) + + # whether or not golang chaincode should be linked dynamically + dynamicLink: false + + java: + # This is an image based on java:openjdk-8 with addition compiler + # tools added for java shim layer packaging. + # This image is packed with shim layer libraries that are necessary + # for Java chaincode runtime. + runtime: $(DOCKER_NS)/fabric-javaenv:2.5 + + node: + # This is an image based on node:$(NODE_VER)-alpine + runtime: $(DOCKER_NS)/fabric-nodeenv:2.5 + + # List of directories to treat as external builders and launchers for + # chaincode. The external builder detection processing will iterate over the + # builders in the order specified below. + # If you don't need to fallback to the default Docker builder, also unconfigure vm.endpoint above. + # To override this property via env variable use CORE_CHAINCODE_EXTERNALBUILDERS: [{name: x, path: dir1}, {name: y, path: dir2}] + externalBuilders: + - name: ccaas_builder + path: /opt/hyperledger/ccaas_builder + propagateEnvironment: + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG + + + # The maximum duration to wait for the chaincode build and install process + # to complete. + installTimeout: 300s + + # Timeout duration for starting up a container and waiting for Register + # to come through. + startuptimeout: 300s + + # Timeout duration for Invoke and Init calls to prevent runaway. + # This timeout is used by all chaincodes in all the channels, including + # system chaincodes. + # Note that during Invoke, if the image is not available (e.g. being + # cleaned up when in development environment), the peer will automatically + # build the image, which might take more time. In production environment, + # the chaincode image is unlikely to be deleted, so the timeout could be + # reduced accordingly. + executetimeout: 30s + + # There are 2 modes: "dev" and "net". + # In dev mode, user runs the chaincode after starting peer from + # command line on local machine. + # In net mode, peer will run chaincode in a docker container. + mode: net + + # keepalive in seconds. In situations where the communication goes through a + # proxy that does not support keep-alive, this parameter will maintain connection + # between peer and chaincode. + # A value <= 0 turns keepalive off + keepalive: 0 + + # enabled system chaincodes + system: + _lifecycle: enable + cscc: enable + lscc: enable + qscc: enable + + # Logging section for the chaincode container + logging: + # Default level for all loggers within the chaincode container + level: info + # Override default level for the 'shim' logger + shim: warning + # Format for the chaincode container logs + format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' + +############################################################################### +# +# Ledger section - ledger configuration encompasses both the blockchain +# and the state +# +############################################################################### +ledger: + + blockchain: + + state: + # stateDatabase - options are "goleveldb", "CouchDB" + # goleveldb - default state database stored in goleveldb. + # CouchDB - store state database in CouchDB + stateDatabase: goleveldb + # Limit on the number of records to return per query + totalQueryLimit: 100000 + couchDBConfig: + # It is recommended to run CouchDB on the same server as the peer, and + # not map the CouchDB container port to a server port in docker-compose. + # Otherwise proper security must be provided on the connection between + # CouchDB client (on the peer) and server. + couchDBAddress: 127.0.0.1:5984 + # This username must have read and write authority on CouchDB + username: + # The password is recommended to pass as an environment variable + # during start up (eg CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD). + # If it is stored here, the file must be access control protected + # to prevent unintended users from discovering the password. + password: + # Number of retries for CouchDB errors + maxRetries: 3 + # Number of retries for CouchDB errors during peer startup. + # The delay between retries doubles for each attempt. + # Default of 10 retries results in 11 attempts over 2 minutes. + maxRetriesOnStartup: 10 + # CouchDB request timeout (unit: duration, e.g. 20s) + requestTimeout: 35s + # Limit on the number of records per each CouchDB query + # Note that chaincode queries are only bound by totalQueryLimit. + # Internally the chaincode may execute multiple CouchDB queries, + # each of size internalQueryLimit. + internalQueryLimit: 1000 + # Limit on the number of records per CouchDB bulk update batch + maxBatchUpdateSize: 1000 + # Create the _global_changes system database + # This is optional. Creating the global changes database will require + # additional system resources to track changes and maintain the database + createGlobalChangesDB: false + # CacheSize denotes the maximum mega bytes (MB) to be allocated for the in-memory state + # cache. Note that CacheSize needs to be a multiple of 32 MB. If it is not a multiple + # of 32 MB, the peer would round the size to the next multiple of 32 MB. + # To disable the cache, 0 MB needs to be assigned to the cacheSize. + cacheSize: 64 + + history: + # enableHistoryDatabase - options are true or false + # Indicates if the history of key updates should be stored. + # All history 'index' will be stored in goleveldb, regardless if using + # CouchDB or alternate database for the state. + enableHistoryDatabase: true + + pvtdataStore: + # the maximum db batch size for converting + # the ineligible missing data entries to eligible missing data entries + collElgProcMaxDbBatchSize: 5000 + # the minimum duration (in milliseconds) between writing + # two consecutive db batches for converting the ineligible missing data entries to eligible missing data entries + collElgProcDbBatchesInterval: 1000 + # The missing data entries are classified into two categories: + # (1) prioritized + # (2) deprioritized + # Initially, all missing data are in the prioritized list. When the + # reconciler is unable to fetch the missing data from other peers, + # the unreconciled missing data would be moved to the deprioritized list. + # The reconciler would retry deprioritized missing data after every + # deprioritizedDataReconcilerInterval (unit: minutes). Note that the + # interval needs to be greater than the reconcileSleepInterval + deprioritizedDataReconcilerInterval: 60m + + snapshots: + # Path on the file system where peer will store ledger snapshots + rootDir: /var/hyperledger/production/snapshots + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # most operations service endpoints require client authentication when TLS + # is enabled. clientAuthRequired requires client certificate authentication + # at the TLS layer to access all resources. + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # metrics provider is one of statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: \ No newline at end of file From e7c3d8e0ffd894b412f923b3d45a3a6df480c736 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Fri, 6 Jun 2025 10:44:35 -0500 Subject: [PATCH 306/471] Chaincode install test passed Signed-off-by: Real-Artisan Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 230 +- ...1chaincode-raft-explorer.json.test.ts.snap | 3367 +---------------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 8 +- ...2chaincodes-private-data.yaml.test.ts.snap | 24 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 16 +- ...1chaincode-raft-explorer.json.test.ts.snap | 8 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 8 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 8 +- src/.DS_Store | Bin 0 -> 6148 bytes src/setup-docker/.DS_Store | Bin 0 -> 6148 bytes src/setup-docker/templates/.DS_Store | Bin 0 -> 8196 bytes .../templates/fabric-docker/.DS_Store | Bin 0 -> 6148 bytes .../templates/fabric-docker/core.yaml | 777 ---- 13 files changed, 51 insertions(+), 4395 deletions(-) create mode 100644 src/.DS_Store create mode 100644 src/setup-docker/.DS_Store create mode 100644 src/setup-docker/templates/.DS_Store create mode 100644 src/setup-docker/templates/fabric-docker/.DS_Store delete mode 100644 src/setup-docker/templates/fabric-docker/core.yaml diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index f9b00a23c..d72aa5fbc 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1725,23 +1725,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -1867,23 +1851,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -1956,23 +1924,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "lang": "ccaas", "name": "chaincode1", @@ -2054,23 +2006,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -2196,23 +2132,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -2243,12 +2163,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabloConfig": "", }, "tls": true, - "tools": { - "explorer": { - "address": "explorer.example.com", - "port": 7010, - }, - }, + "tools": {}, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -2443,23 +2358,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], } @@ -11163,23 +11062,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -11305,23 +11188,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -11394,23 +11261,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "lang": "ccaas", "name": "chaincode1", @@ -11492,23 +11343,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, "name": "my-channel1", "ordererGroup": { @@ -11634,23 +11469,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], "profileName": "MyChannel1", @@ -11681,12 +11500,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabloConfig": "", }, "tls": true, - "tools": { - "explorer": { - "address": "explorer.example.com", - "port": 7010, - }, - }, + "tools": {}, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -11881,23 +11695,7 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": { - "fabloRest": { - "address": "fablo-rest.org1.example.com", - "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", - "fabricCaName": "ca.org1.example.com", - "fabricCaUrl": "https://ca.org1.example.com:7054", - "logging": { - "error": "console", - "info": "console", - "warn": "console", - }, - "mspId": "Org1MSP", - "port": 8801, - }, - }, + "tools": {}, }, ], } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index f83115f3a..b79c8f74e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3368 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"/config -/crypto-config -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"################################################################################ -# SECTION: Capabilities -################################################################################ -Capabilities: - Channel: &ChannelCapabilities - V2_0: true - Orderer: &OrdererCapabilities - V2_0: true - Application: &ApplicationCapabilities - V2_5: true - -################################################################################ -# CHANNEL Defaults -################################################################################ -Channel: &ChannelDefaults - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Capabilities: - <<: *ChannelCapabilities - -################################################################################ -# Section: Organizations -################################################################################ -Organizations: - - &Orderer - Name: OrdererMSP - ID: OrdererMSP - MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Writers: - Type: Signature - Rule: "OR('OrdererMSP.member')" - Admins: - Type: Signature - Rule: "OR('OrdererMSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('OrdererMSP.member')" - - AnchorPeers: - - - &Org1 - Name: Org1MSP - ID: Org1MSP - MSPDir: crypto-config/peerOrganizations/org1.example.com/msp - - Policies: - Readers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Writers: - Type: Signature - Rule: "OR('Org1MSP.member')" - Admins: - Type: Signature - Rule: "OR('Org1MSP.admin')" - Endorsement: - Type: Signature - Rule: "OR('Org1MSP.member')" - - AnchorPeers: - - Host: peer0.org1.example.com - Port: 7041 - -################################################################################ -# SECTION: Application -################################################################################ -Application: &ApplicationDefaults - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Application policies, their canonical path is - # /Channel/Application/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - Endorsement: - Type: ImplicitMeta - Rule: "MAJORITY Endorsement" - Capabilities: - <<: *ApplicationCapabilities - -################################################################################ -# SECTION: Orderer -################################################################################ -Orderer: &Group1Defaults - OrdererType: etcdraft - Addresses: - - orderer0.group1.orderer.example.com:7030 - EtcdRaft: - Consenters: - - Host: orderer0.group1.orderer.example.com - Port: 7030 - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - BatchTimeout: 2s - BatchSize: - MaxMessageCount: 1 - AbsoluteMaxBytes: 99 MB - PreferredMaxBytes: 512 KB - Organizations: - # Policies defines the set of policies at this level of the config tree - # For Orderer policies, their canonical path is - # /Channel/Orderer/ - Policies: - Readers: - Type: ImplicitMeta - Rule: "ANY Readers" - Writers: - Type: ImplicitMeta - Rule: "ANY Writers" - Admins: - Type: ImplicitMeta - Rule: "MAJORITY Admins" - # BlockValidation specifies what signatures must be included in the block - # from the orderer for the peer to validate it. - BlockValidation: - Type: ImplicitMeta - Rule: "ANY Writers" - Capabilities: - <<: *OrdererCapabilities - -################################################################################ -# Profile -################################################################################ -# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml - -Profiles: - # Profile used to create Genesis block for group group1 # - Group1Genesis: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *OrdererCapabilities - Consortiums: - SampleConsortium: - Organizations: - - *Orderer - - *Org1 - - # Profile used to create channeltx for my-channel1 # - MyChannel1: - <<: *ChannelDefaults - Orderer: - <<: *Group1Defaults - Organizations: - - *Orderer - Capabilities: - <<: *ApplicationCapabilities - Consortium: SampleConsortium - Consortiums: - SampleConsortium: - Organizations: - - *Org1 - Application: - <<: *ApplicationDefaults - Organizations: - - *Org1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-orderer", - "description": "Connection profile for Orderer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Orderer" - }, - "organizations": { - "Orderer": { - "mspid": "OrdererMSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.orderer.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.orderer.example.com": { - "url": "https://localhost:7020", - "caName": "ca.orderer.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-orderer -description: Connection profile for Orderer in Fablo network -version: 1.0.0 -client: - organization: Orderer -organizations: - Orderer: - mspid: OrdererMSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.orderer.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.orderer.example.com: - url: https://localhost:7020 - caName: ca.orderer.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Org1 in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1" - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "peers": [ - "peer0.org1.example.com" - ], - "certificateAuthorities": [ - "ca.org1.example.com" - ] - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://localhost:7041", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer0.org1.example.com" - } - } - }, - "certificateAuthorities": { - "ca.org1.example.com": { - "url": "https://localhost:7040", - "caName": "ca.org1.example.com", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" - }, - "httpOptions": { - "verify": false - } - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"name: fablo-test-network-org1 -description: Connection profile for Org1 in Fablo network -version: 1.0.0 -client: - organization: Org1 -organizations: - Org1: - mspid: Org1MSP - peers: - - peer0.org1.example.com - certificateAuthorities: - - ca.org1.example.com -peers: - peer0.org1.example.com: - url: grpcs://localhost:7041 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer0.org1.example.com -certificateAuthorities: - ca.org1.example.com: - url: https://localhost:7040 - caName: ca.org1.example.com - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem - httpOptions: - verify: false -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Orderer - Domain: orderer.example.com - Specs: - - Hostname: orderer0.group1 - Template: - Count: 0 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"PeerOrgs: - - Name: Org1 - Domain: org1.example.com - Specs: - Template: - Count: 1 - Users: - Count: 1 -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "network-configs": { - "network-org1": { - "name": "Network of Org1", - "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" - } - }, - "license": "Apache-2.0" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"{ - "name": "fablo-test-network-org1", - "description": "Connection profile for Hyperledger Explorer in Fablo network", - "version": "1.0.0", - "client": { - "organization": "Org1", - "tlsEnable": true, - "enableAuthentication": true, - "adminCredential": { - "id": "admin", - "password": "adminpw" - }, - "connection": { - "timeout": { - "peer": { - "endorser": "300" - }, - "orderer": "300" - } - } - }, - "organizations": { - "Org1": { - "mspid": "Org1MSP", - "adminPrivateKey": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" - }, - "peers": [ - "peer0.org1.example.com" - ], - "signedCert": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" - } - } - }, - "peers": { - "peer0.org1.example.com": { - "url": "grpcs://peer0.org1.example.com:7041", - "tlsCACerts": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" - } - } - }, - "channels": { - "my-channel1": { - "peers": {} - } - } -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - orderer: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"############################################################################# -# This is a configuration file for the fabric-ca-server command. -# -# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES -# ------------------------------------------------ -# Each configuration element can be overridden via command line -# arguments or environment variables. The precedence for determining -# the value of each element is as follows: -# 1) command line argument -# Examples: -# a) --port 443 -# To set the listening port -# b) --ca.keyfile ../mykey.pem -# To set the "keyfile" element in the "ca" section below; -# note the '.' separator character. -# 2) environment variable -# Examples: -# a) FABRIC_CA_SERVER_PORT=443 -# To set the listening port -# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" -# To set the "keyfile" element in the "ca" section below; -# note the '_' separator character. -# 3) configuration file -# 4) default value (if there is one) -# All default values are shown beside each element below. -# -# FILE NAME ELEMENTS -# ------------------ -# The value of all fields whose name ends with "file" or "files" are -# name or names of other files. -# For example, see "tls.certfile" and "tls.clientauth.certfiles". -# The value of each of these fields can be a simple filename, a -# relative path, or an absolute path. If the value is not an -# absolute path, it is interpreted as being relative to the location -# of this configuration file. -# -############################################################################# - -# Version of config file -version: 1.5.5 - -# Server's listening port (default: 7054) -port: 7054 - -# Cross-Origin Resource Sharing (CORS) -cors: - enabled: false - origins: - - "*" - -# Enables debug logging (default: false) -debug: false - -# Size limit of an acceptable CRL in bytes (default: 512000) -crlsizelimit: 512000 - -############################################################################# -# TLS section for the server's listening port -# -# The following types are supported for client authentication: NoClientCert, -# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, -# and RequireAndVerifyClientCert. -# -# Certfiles is a list of root certificate authorities that the server uses -# when verifying client certificates. -############################################################################# -tls: - # Enable TLS (default: false) - enabled: false - # TLS for the server's listening port - certfile: - keyfile: - clientauth: - type: noclientcert - certfiles: - -############################################################################# -# The CA section contains information related to the Certificate Authority -# including the name of the CA, which should be unique for all members -# of a blockchain network. It also includes the key and certificate files -# used when issuing enrollment certificates (ECerts). -# The chainfile (if it exists) contains the certificate chain which -# should be trusted for this CA, where the 1st in the chain is always the -# root CA certificate. -############################################################################# -ca: - # Name of this CA - name: - # Key file (is only used to import a private key into BCCSP) - keyfile: - # Certificate file (default: ca-cert.pem) - certfile: - # Chain file - chainfile: - -############################################################################# -# The gencrl REST endpoint is used to generate a CRL that contains revoked -# certificates. This section contains configuration options that are used -# during gencrl request processing. -############################################################################# -crl: - # Specifies expiration for the generated CRL. The number of hours - # specified by this property is added to the UTC time, the resulting time - # is used to set the 'Next Update' date of the CRL. - expiry: 24h - -############################################################################# -# The registry section controls how the fabric-ca-server does two things: -# 1) authenticates enrollment requests which contain a username and password -# (also known as an enrollment ID and secret). -# 2) once authenticated, retrieves the identity's attribute names and values. -# These attributes are useful for making access control decisions in -# chaincode. -# There are two main configuration options: -# 1) The fabric-ca-server is the registry. -# This is true if "ldap.enabled" in the ldap section below is false. -# 2) An LDAP server is the registry, in which case the fabric-ca-server -# calls the LDAP server to perform these tasks. -# This is true if "ldap.enabled" in the ldap section below is true, -# which means this "registry" section is ignored. -############################################################################# -registry: - # Maximum number of times a password/secret can be reused for enrollment - # (default: -1, which means there is no limit) - maxenrollments: -1 - - # Contains identity information which is used when LDAP is disabled - identities: - - name: admin - pass: adminpw - type: client - affiliation: "" - attrs: - hf.Registrar.Roles: "*" - hf.Registrar.DelegateRoles: "*" - hf.Revoker: true - hf.IntermediateCA: true - hf.GenCRL: true - hf.Registrar.Attributes: "*" - hf.AffiliationMgr: true - -############################################################################# -# Database section -# Supported types are: "sqlite3", "postgres", and "mysql". -# The datasource value depends on the type. -# If the type is "sqlite3", the datasource value is a file name to use -# as the database store. Since "sqlite3" is an embedded database, it -# may not be used if you want to run the fabric-ca-server in a cluster. -# To run the fabric-ca-server in a cluster, you must choose "postgres" -# or "mysql". -############################################################################# -db: - type: sqlite3 - datasource: fabric-ca-server.db - tls: - enabled: false - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# LDAP section -# If LDAP is enabled, the fabric-ca-server calls LDAP to: -# 1) authenticate enrollment ID and secret (i.e. username and password) -# for enrollment requests; -# 2) To retrieve identity attributes -############################################################################# -ldap: - # Enables or disables the LDAP client (default: false) - # If this is set to true, the "registry" section is ignored. - enabled: false - # The URL of the LDAP server - url: ldap://:@:/ - # TLS configuration for the client connection to the LDAP server - tls: - certfiles: - client: - certfile: - keyfile: - # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes - attribute: - # 'names' is an array of strings containing the LDAP attribute names which are - # requested from the LDAP server for an LDAP identity's entry - names: ['uid', 'member'] - # The 'converters' section is used to convert an LDAP entry to the value of - # a fabric CA attribute. - # For example, the following converts an LDAP 'uid' attribute - # whose value begins with 'revoker' to a fabric CA attribute - # named "hf.Revoker" with a value of "true" (because the boolean expression - # evaluates to true). - # converters: - # - name: hf.Revoker - # value: attr("uid") =~ "revoker*" - converters: - - name: - value: - # The 'maps' section contains named maps which may be referenced by the 'map' - # function in the 'converters' section to map LDAP responses to arbitrary values. - # For example, assume a user has an LDAP attribute named 'member' which has multiple - # values which are each a distinguished name (i.e. a DN). For simplicity, assume the - # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. - # Further assume the following configuration. - # converters: - # - name: hf.Registrar.Roles - # value: map(attr("member"),"groups") - # maps: - # groups: - # - name: dn1 - # value: peer - # - name: dn2 - # value: client - # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be - # "peer,client,dn3". This is because the value of 'attr("member")' is - # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of - # "group" replaces "dn1" with "peer" and "dn2" with "client". - maps: - groups: - - name: - value: - -############################################################################# -# Affiliations section. Fabric CA server can be bootstrapped with the -# affiliations specified in this section. Affiliations are specified as maps. -# For example: -# businessunit1: -# department1: -# - team1 -# businessunit2: -# - department2 -# - department3 -# -# Affiliations are hierarchical in nature. In the above example, -# department1 (used as businessunit1.department1) is the child of businessunit1. -# team1 (used as businessunit1.department1.team1) is the child of department1. -# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) -# are children of businessunit2. -# Note: Affiliations are case sensitive except for the non-leaf affiliations -# (like businessunit1, department1, businessunit2) that are specified in the configuration file, -# which are always stored in lower case. -############################################################################# -affiliations: - org1: - -############################################################################# -# Signing section -# -# The "default" subsection is used to sign enrollment certificates; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -# -# The "ca" profile subsection is used to sign intermediate CA certificates; -# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. -# Note that "isca" is true, meaning that it issues a CA certificate. -# A maxpathlen of 0 means that the intermediate CA cannot issue other -# intermediate CA certificates, though it can still issue end entity certificates. -# (See RFC 5280, section 4.2.1.9) -# -# The "tls" profile subsection is used to sign TLS certificate requests; -# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. -############################################################################# -signing: - default: - usage: - - digital signature - expiry: 8760h - profiles: - ca: - usage: - - cert sign - - crl sign - expiry: 43800h - caconstraint: - isca: true - maxpathlen: 0 - tls: - usage: - - signing - - key encipherment - - server auth - - client auth - - key agreement - expiry: 8760h - -########################################################################### -# Certificate Signing Request (CSR) section. -# This controls the creation of the root CA certificate. -# The expiration for the root CA certificate is configured with the -# "ca.expiry" field below, whose default value is "131400h" which is -# 15 years in hours. -# The pathlength field is used to limit CA certificate hierarchy as described -# in section 4.2.1.9 of RFC 5280. -# Examples: -# 1) No pathlength value means no limit is requested. -# 2) pathlength == 1 means a limit of 1 is requested which is the default for -# a root CA. This means the root CA can issue intermediate CA certificates, -# but these intermediate CAs may not in turn issue other CA certificates -# though they can still issue end entity certificates. -# 3) pathlength == 0 means a limit of 0 is requested; -# this is the default for an intermediate CA, which means it can not issue -# CA certificates though it can still issue end entity certificates. -########################################################################### -csr: - cn: fabric-ca-server - keyrequest: - algo: ecdsa - size: 256 - names: - - C: US - ST: "North Carolina" - L: - O: Hyperledger - OU: Fabric - hosts: - - 483cccf16a98 - - localhost - ca: - expiry: 131400h - pathlength: 1 - -########################################################################### -# Each CA can issue both X509 enrollment certificate as well as Idemix -# Credential. This section specifies configuration for the issuer component -# that is responsible for issuing Idemix credentials. -########################################################################### -idemix: - # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an - # Idemix credential. The issuer will create a pool revocation handles of this specified size. When - # a credential is requested, issuer will get handle from the pool and assign it to the credential. - # Issuer will repopulate the pool with new handles when the last handle in the pool is used. - # A revocation handle and credential revocation information (CRI) are used to create non revocation proof - # by the prover to prove to the verifier that her credential is not revoked. - rhpoolsize: 1000 - - # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer - # and second step is send credential request that is constructed using the nonce to the isuser to - # request a credential. This configuration property specifies expiration for the nonces. By default is - # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). - nonceexpiration: 15s - - # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. - # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) - noncesweepinterval: 15m - -############################################################################# -# BCCSP (BlockChain Crypto Service Provider) section is used to select which -# crypto library implementation to use -############################################################################# -bccsp: - default: SW - sw: - hash: SHA2 - security: 256 - filekeystore: - # The directory used for the software file-based keystore - keystore: msp/keystore - -############################################################################# -# Multi CA section -# -# Each Fabric CA server contains one CA by default. This section is used -# to configure multiple CAs in a single server. -# -# 1) --cacount -# Automatically generate non-default CAs. The names of these -# additional CAs are "ca1", "ca2", ... "caN", where "N" is -# This is particularly useful in a development environment to quickly set up -# multiple CAs. Note that, this config option is not applicable to intermediate CA server -# i.e., Fabric CA server that is started with intermediate.parentserver.url config -# option (-u command line option) -# -# 2) --cafiles -# For each CA config file in the list, generate a separate signing CA. Each CA -# config file in this list MAY contain all of the same elements as are found in -# the server config file except port, debug, and tls sections. -# -# Examples: -# fabric-ca-server start -b admin:adminpw --cacount 2 -# -# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml -# --cafiles ca/ca2/fabric-ca-server-config.yaml -# -############################################################################# - -cacount: - -cafiles: - -############################################################################# -# Intermediate CA section -# -# The relationship between servers and CAs is as follows: -# 1) A single server process may contain or function as one or more CAs. -# This is configured by the "Multi CA section" above. -# 2) Each CA is either a root CA or an intermediate CA. -# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. -# -# This section pertains to configuration of #2 and #3. -# If the "intermediate.parentserver.url" property is set, -# then this is an intermediate CA with the specified parent -# CA. -# -# parentserver section -# url - The URL of the parent server -# caname - Name of the CA to enroll within the server -# -# enrollment section used to enroll intermediate CA with parent CA -# profile - Name of the signing profile to use in issuing the certificate -# label - Label to use in HSM operations -# -# tls section for secure socket connection -# certfiles - PEM-encoded list of trusted root certificate files -# client: -# certfile - PEM-encoded certificate file for when client authentication -# is enabled on server -# keyfile - PEM-encoded key file for when client authentication -# is enabled on server -############################################################################# -intermediate: - parentserver: - url: - caname: - - enrollment: - hosts: - profile: - label: - - tls: - certfiles: - client: - certfile: - keyfile: - -############################################################################# -# CA configuration section -# -# Configure the number of incorrect password attempts are allowed for -# identities. By default, the value of 'passwordattempts' is 10, which -# means that 10 incorrect password attempts can be made before an identity get -# locked out. -############################################################################# -cfg: - identities: - passwordattempts: 10 - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # require client certificate authentication to access all resources - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: server -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" -source "$FABLO_NETWORK_ROOT/fabric-docker/.env" -source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" - -networkUp() { - generateArtifacts - startNetwork - generateChannelsArtifacts - installChannels - installChaincodes - notifyOrgsAboutChannels - printStartSuccessInfo -} - -if [ "$1" = "up" ]; then - networkUp -elif [ "$1" = "down" ]; then - networkDown -elif [ "$1" = "reset" ]; then - networkDown - networkUp -elif [ "$1" = "start" ]; then - startNetwork -elif [ "$1" = "stop" ]; then - stopNetwork -elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then - installChaincodes -elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then - installChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then - upgradeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then - runDevModeChaincode "$3" "$4" -elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then - chaincodeInvoke "$3" "$4" "$5" "$6" "$7" -elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then - chaincodeList "$3" "$4" -elif [ "$1" = "channel" ]; then - channelQuery "\${@:2}" -elif [ "$1" = "snapshot" ]; then - createSnapshot "$2" -elif [ "$1" = "clone-to" ]; then - cloneSnapshot "$2" "\${3:-""}" -elif [ "$1" = "help" ]; then - printHelp -elif [ "$1" = "--help" ]; then - printHelp -else - echo "No command specified" - echo "Basic commands are: up, down, start, stop, reset" - echo "To list channel query helper commands type: 'fablo channel --help'" - echo "Also check: 'chaincode install'" - echo "Use 'help' or '--help' for more information" -fi -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"FABLO_VERSION=2.2.0 -FABLO_BUILD= -FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 - -COUCHDB_VERSION=3.1 -FABRIC_COUCHDB_VERSION=0.4.18 - -FABLO_CONFIG= -CHAINCODES_BASE_DIR= - -COMPOSE_PROJECT_NAME= -LOGGING_LEVEL=info - -FABRIC_VERSION=2.5.12 -FABRIC_TOOLS_VERSION=2.5.12 -FABRIC_CA_VERSION=1.5.5 -FABRIC_CA_POSTGRES_VERSION=14 -FABRIC_CCENV_VERSION=2.5.12 -FABRIC_BASEOS_VERSION=2.5.12 -FABRIC_JAVAENV_VERSION=2.5 -FABRIC_NODEENV_VERSION=2.5 -RECOMMENDED_NODE_VERSION=16 - -ROOT_CA_ADMIN_NAME=admin -ROOT_CA_ADMIN_PASSWORD=adminpw - -ORDERER_CA_ADMIN_NAME=admin -ORDERER_CA_ADMIN_PASSWORD=adminpw - -ORG1_CA_ADMIN_NAME=admin -ORG1_CA_ADMIN_PASSWORD=adminpw - -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -chaincodeList() { - if [ "$#" -ne 2 ]; then - echo "Expected 2 parameters for chaincode list, but got: $*" - exit 1 - - elif [ "$1" = "peer0.org1.example.com" ]; then - - peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - - else - - echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" - exit 1 - - fi -} - -# Function to perform chaincode invoke. Accepts 5 parameters: -# 1. comma-separated peers -# 2. channel name -# 3. chaincode name -# 4. chaincode command -# 5. transient data (optional) -chaincodeInvoke() { - if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then - echo "Expected 4 or 5 parameters for chaincode list, but got: $*" - echo "Usage: fablo chaincode invoke [transient]" - exit 1 - fi - - # Cli needs to be from the same org as the first peer - if [[ "$1" == "peer0.org1.example.com"* ]]; then - cli="cli.org1.example.com" - fi - - peer_addresses="$1" - peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" - - peer_certs="$1" - peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" - - if [ "$2" = "my-channel1" ]; then - ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" - fi - peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" - -set -eu - -channelQuery() { - if [ "$#" -eq 1 ]; then - printChannelsHelp - - elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then - - peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif - - [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] - then - - peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - TARGET_FILE=\${6:-"$channel-config.json"} - - peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then - BLOCK_NAME=$2 - TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - - peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - - else - - echo "$@" - echo "$1, $2, $3, $4, $5, $6, $7, $#" - printChannelsHelp - fi - -} - -printChannelsHelp() { - echo "Channel management commands:" - echo "" - - echo "fablo channel list org1 peer0" - echo -e "\\t List channels on 'peer0' of 'Org1'". - echo "" - - echo "fablo channel getinfo my-channel1 org1 peer0" - echo -e "\\t Get channel info on 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" - echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - echo "fablo channel fetch my-channel1 org1 peer0 [file name]" - echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". - echo "" - -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -generateArtifacts() { - printHeadline "Generating basic configs" "U1F913" - - printItalics "Generating crypto material for Orderer" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating crypto material for Org1" "U1F512" - certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - - printItalics "Generating genesis block for group group1" "U1F3E0" - genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" - - # Create directories to avoid permission errors on linux - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -startNetwork() { - printHeadline "Starting network" "U1F680" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - sleep 4 -} - -generateChannelsArtifacts() { - printHeadline "Generating config for 'my-channel1'" "U1F913" - createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" -} - -installChannels() { - printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - -} - -installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - local version="0.0.1" - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - else - echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - -} - -installChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - fi -} - -runDevModeChaincode() { - local chaincodeName=$1 - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - local version="0.0.1" - printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" - - fi -} - -upgradeChaincode() { - local chaincodeName="$1" - if [ -z "$chaincodeName" ]; then - echo "Error: chaincode name is not provided" - exit 1 - fi - - local version="$2" - if [ -z "$version" ]; then - echo "Error: chaincode version is not provided" - exit 1 - fi - - if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then - printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodePackageCaas "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "7052" "peer0.org1.example.com_chaincode1" "true" - printHeadline "Installing 'chaincode1' for Org1" "U1F60E" - chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" - printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" - - else - echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" - fi - fi -} - -notifyOrgsAboutChannels() { - - printHeadline "Creating new channel config blocks" "U1F537" - createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" - - printHeadline "Notyfing orgs about channels" "U1F4E2" - notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - printHeadline "Deleting new channel config blocks" "U1F52A" - deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" - -} - -printStartSuccessInfo() { - printHeadline "Done! Enjoy your fresh network" "U1F984" -} - -stopNetwork() { - printHeadline "Stopping network" "U1F68F" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) - sleep 4 -} - -networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do - echo "Removing container $container..." - docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" - done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do - echo "Removing image $image..." - docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" - done - - printf "Removing generated configs... \\U1F5D1 \\n" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" - rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" - - printHeadline "Done! Network was purged" "U1F5D1" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"networks: - basic: - -services: - - ca.orderer.example.com: - container_name: ca.orderer.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - ports: - - 7020:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - networks: - - basic - - cli.orderer.example.com: - container_name: cli.orderer.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.orderer.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=OrdererMSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - orderer0.group1.orderer.example.com: - container_name: orderer0.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7030 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Genesis file configuration (for solo and raft) - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7030:7030 - - 8030:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - - ca.org1.example.com: - container_name: ca.org1.example.com - image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} - environment: - - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server - - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com - - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem - - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - FABRIC_CA_SERVER_TLS_ENABLED=true - - FABRIC_CA_SERVER_DB_TLS_ENABLED=false - - FABRIC_CA_SERVER_DB_TYPE=postgres - - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable - ports: - - 7040:7054 - working_dir: /etc/hyperledger/fabric-ca-server - command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' - volumes: - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto - - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml - depends_on: - db.ca.org1.example.com: - condition: service_healthy - networks: - - basic - - db.ca.org1.example.com: - container_name: db.ca.org1.example.com - image: postgres:\${FABRIC_CA_POSTGRES_VERSION} - environment: - - POSTGRES_PASSWORD=caDbPass12345 - - POSTGRES_USER=postgres - - POSTGRES_DB=fabriccaserver - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - cli.org1.example.com: - container_name: cli.org1.example.com - image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} - tty: true - environment: - - GOPATH=/opt/gopath - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - CORE_PEER_ID=cli.org1.example.com - - CORE_CHAINCODE_KEEPALIVE=10 - # - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt - - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key - - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt - - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem - working_dir: /var/hyperledger/cli/ - command: /bin/bash - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ - - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" - networks: - - basic - - fablo-rest.org1.example.com: - container_name: fablo-rest.org1.example.com - image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} - environment: - - PORT=8000 - - MSP_ID=Org1MSP - - FABRIC_CA_URL=https://ca.org1.example.com:7054 - - FABRIC_CA_NAME=ca.org1.example.com - - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 - - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - - HFC_LOGGING={"error":"console","warn":"console","info":"console"} - volumes: - # note: fablo needs access to all anchor peer certs - - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro - ports: - - 8801:8000 - networks: - - basic - - peer0.org1.example.com: - container_name: peer0.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer0.org1.example.com - - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 - - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8041:9440 - - 7041:7041 - depends_on: - couchdb.peer0.org1.example.com: - condition: service_healthy - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - couchdb.peer0.org1.example.com: - container_name: couchdb.peer0.org1.example.com - image: couchdb:\${COUCHDB_VERSION} - environment: - - COUCHDB_USER=peer0 - - COUCHDB_PASSWORD=peer0Password - healthcheck: - test: "curl -f http://localhost:5984/" - interval: 5s - timeout: 10s - retries: 7 - ports: - - 5100:5984 - networks: - - basic - - db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} - container_name: db.explorer.example.com - environment: - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWORD=password - healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" - interval: 5s - timeout: 10s - retries: 7 - volumes: - - /var/lib/postgresql/data - networks: - - basic - - explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} - restart: on-failure:8 - container_name: explorer.example.com - environment: - - DATABASE_HOST=db.explorer.example.com - - DATABASE_DATABASE=fabricexplorer - - DATABASE_USERNAME=hppoc - - DATABASE_PASSWD=password - - LOG_LEVEL_APP=debug - - LOG_LEVEL_DB=debug - - LOG_LEVEL_CONSOLE=info - - LOG_CONSOLE_STDOUT=true - - DISCOVERY_AS_LOCALHOST=false - volumes: - - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json - - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile - - ../fabric-config/crypto-config:/tmp/crypto - ports: - - "7010:8080" - depends_on: - db.explorer.example.com: - condition: service_healthy - networks: - - basic - - peer0.org1.example.com_chaincode1: - container_name: peer0.org1.example.com_chaincode1 - image: ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0 - pull_policy: always - environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 - - CHAINCODE_ID=chaincode1:0.0.1 - ports: - - 7052:7052 - networks: - - basic -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -certsGenerate() { - local CONTAINER_NAME=certsGenerate - - local CONFIG_PATH=$1 - local CRYPTO_CONFIG_FILE_NAME=$2 - local ORG_PATH=$3 - local OUTPUT_PATH=$4 - local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH - - echo "Generating certs..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" - inputLog "ORG_PATH: $ORG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" - - if [ -d "$FULL_CERT_PATH" ]; then - echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME - - docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME - - # shellcheck disable=2044 - for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do - dir=$(dirname "$file") - mv "\${dir}"/*_sk "\${dir}"/priv-key.pem - done -} - -genesisBlockCreate() { - local CONTAINER_NAME=genesisBlockCreate - - local CONFIG_PATH=$1 - local OUTPUT_PATH=$2 - local GENESIS_PROFILE_NAME=$3 - local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block - - echo "Creating genesis block..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" - inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" - - if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then - echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME - - mkdir -p "$OUTPUT_PATH" - docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createChannelTx() { - local CONTAINER_NAME=createChannelTx - - local CHANNEL_NAME=$1 - local CONFIG_PATH=$2 - local CONFIG_PROFILE=$3 - local OUTPUT_PATH=$4 - local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx - - echo "Creating channelTx for $CHANNEL_NAME..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" - - if [ -f "$CHANNEL_TX_PATH" ]; then - echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME - docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -createNewChannelUpdateTx() { - local CONTAINER_NAME=createAnchorPeerUpdateTx - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CONFIG_PROFILE=$3 - local CONFIG_PATH=$4 - local OUTPUT_PATH=$5 - - ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" - CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" - - echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then - echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" - echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" - exit 1 - fi - - docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME - docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME - - docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME - docker exec -i $CONTAINER_NAME configtxgen \\ - --configPath ./fabric-config \\ - -profile "\${CONFIG_PROFILE}" \\ - -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ - -channelID "\${CHANNEL_NAME}" \\ - -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME - - docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME - - removeContainer $CONTAINER_NAME -} - -notifyOrgAboutNewChannel() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -notifyOrgAboutNewChannelTls() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local PEER_ADDRESS=$4 - local ORDERER_URL=$5 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - local CA_CERT="/var/hyperledger/cli/"\${6} - - echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "MSP_NAME: $MSP_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel update \\ - -c "$CHANNEL_NAME" \\ - -o "$ORDERER_URL" \\ - -f "$ANCHOR_PEER_UPDATE_PATH" \\ - --tls --cafile "$CA_CERT" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -deleteNewChannelUpdateTx() { - local CHANNEL_NAME=$1 - local MSP_NAME=$2 - local CLI_NAME=$3 - local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" - - echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" - inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" - - if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then - docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" - else - echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" - fi -} - -printHeadline() { - bold=$'\\e[1m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -printItalics() { - italics=$'\\e[3m' - end=$'\\e[0m' - - TEXT=$1 - EMOJI=$2 - printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" -} - -inputLog() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -inputLogShort() { - end=$'\\e[0m' - darkGray=$'\\e[90m' - - echo "\${darkGray} $1 \${end}" -} - -certsRemove() { - local CERTS_DIR_PATH=$1 - rm -rf "$CERTS_DIR_PATH" -} - -removeContainer() { - CONTAINER_NAME=$1 - docker rm -f "$CONTAINER_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -printHelp() { - echo "Fablo is powered by SoftwareMill" - - echo "" - echo "usage: ./fabric-docker.sh " - echo "" - - echo "Commands: " - echo "" - echo "./fabric-docker.sh up" - echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." - echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" - echo "" - echo "./fabric-docker.sh down" - echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." - echo "" - echo "./fabric-docker.sh start" - echo -e "\\t Starts already created network." - echo "" - echo "./fabric-docker.sh stop" - echo -e "\\t Stops already running network." - echo "" - echo "./fabric-docker.sh reset" - echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." - echo "" - echo "./fabric-docker.sh channel --help" - echo -e "\\t Detailed help for channel management scripts." - echo "" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash -# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. -# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u - -dockerPullIfMissing() { - local IMAGE="$1" - if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then - docker pull --platform linux/x86_64 "$IMAGE" - fi -} - -node_version_check() { - - local fabric_shim_version="$1" - local nodejs_version - - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 - - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 - - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 - - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 - - else - nodejs_version=18.12 - fi - - echo $nodejs_version - -} - -chaincodeBuild() { - local CHAINCODE_NAME=$1 - local CHAINCODE_LANG=$2 - local CHAINCODE_DIR_PATH=$3 - local RECOMMENDED_NODE_VERSION=$4 - - mkdir -p "$CHAINCODE_DIR_PATH" - - # pull required images upfront in case of arm64 (Apple Silicon) architecture - # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu - # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately - # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly - if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then - if [ "$CHAINCODE_LANG" = "node" ]; then - dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "java" ]; then - dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" - fi - if [ "$CHAINCODE_LANG" = "golang" ]; then - dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" - fi - fi - - if [ "$CHAINCODE_LANG" = "node" ]; then - NODE_VERSION=$(node --version) - fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") - RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") - - if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then - echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" - echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" - fi - - echo "Buiding chaincode '$CHAINCODE_NAME'..." - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" - inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - - # Default to using npm for installation and build - (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - - fi -} - -chaincodePackage() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ - --lang "$CHAINCODE_LANG" \\ - --label "$CHAINCODE_LABEL" - - # set package owner as current (host) user to fix permission issues - docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodePackageCaas() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" - - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - -chaincodeInstall() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CA_CERT=$5 - - echo "Installing chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA_CERT: $CA_CERT" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") - fi - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ - "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeApprove() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COLLECTIONS_CONFIG=\${10} - - echo "Approving chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYINSTALLED_RESPONSE - local CC_PACKAGE_ID - - QUERYINSTALLED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - if [ -z "$CC_PACKAGE_ID" ]; then - CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" - fi - inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --package-id "$CC_PACKAGE_ID" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -chaincodeCommit() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME="$3" - local CHAINCODE_NAME=$4 - local CHAINCODE_VERSION=$5 - local ORDERER_URL=$6 - local ENDORSEMENT=$7 - local INIT_REQUIRED=$8 - local CA_CERT=$9 - local COMMIT_PEER_ADDRESSES=\${10} - local TLS_ROOT_CERT_FILES=\${11} - local COLLECTIONS_CONFIG=\${12} - - echo "Committing chaincode $CHAINCODE_NAME..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "ORDERER_URL: $ORDERER_URL" - inputLog "ENDORSEMENT: $ENDORSEMENT" - inputLog "INIT_REQUIRED: $INIT_REQUIRED" - inputLog "CA_CERT: $CA_CERT" - inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" - inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" - inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - - local CA_CERT_PARAMS=() - if [ -n "$CA_CERT" ]; then - CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") - fi - - local COMMIT_PEER_PARAMS=() - if [ -n "$COMMIT_PEER_ADDRESSES" ]; then - # shellcheck disable=SC2207 - COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) - fi - - local TLS_ROOT_CERT_PARAMS=() - if [ -n "$TLS_ROOT_CERT_FILES" ]; then - # shellcheck disable=SC2207 - TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) - fi - - local ENDORSEMENT_PARAMS=() - if [ -n "$ENDORSEMENT" ]; then - ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") - fi - - local INIT_REQUIRED_PARAMS=() - if [ "$INIT_REQUIRED" = "true" ]; then - INIT_REQUIRED_PARAMS=(--init-required) - fi - - local COLLECTIONS_CONFIG_PARAMS=() - if [ -n "$COLLECTIONS_CONFIG" ]; then - COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") - fi - - local QUERYCOMMITTED_RESPONSE - local SEQUENCE - - QUERYCOMMITTED_RESPONSE="$( - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --output json \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" - )" - SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" - SEQUENCE=$((SEQUENCE + 1)) - inputLog "SEQUENCE: $SEQUENCE" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ - -o "$ORDERER_URL" \\ - -C "$CHANNEL_NAME" \\ - -n "$CHAINCODE_NAME" \\ - -v "$CHAINCODE_VERSION" \\ - --sequence "$SEQUENCE" \\ - "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ - "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ - "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ - "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ - "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ - "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" -} - -peerChaincodeList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - - # Execute the command to list chaincodes - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" -} - -peerChaincodeListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHANNEL_NAME=$3 - local CA_CERT=$4 - - echo "Chaincodes list:" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CA_CERT: $CA_CERT" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ - --channelID "$CHANNEL_NAME" \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" -} - -# Function to perform chaincode invoke -peerChaincodeInvoke() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - 2>&1 -} -# Function to perform chaincode invoke for Tls -peerChaincodeInvokeTls() { - local CLI="$1" - local PEERS="$2" - local CHANNEL="$3" - local CHAINCODE="$4" - local COMMAND="$5" - local TRANSIENT="$6" - local PEER_CERTS="$7" - local CA_CERT="$8" - - echo "Chaincode invoke:" - inputLog "CLI: $CLI" - inputLog "PEERS: $PEERS" - inputLog "CHANNEL: $CHANNEL" - inputLog "CHAINCODE: $CHAINCODE" - inputLog "COMMAND: $COMMAND" - inputLog "TRANSIENT: $TRANSIENT" - inputLog "PEER_CERTS: $PEER_CERTS" - inputLog "CA_CERT: $CA_CERT" - - PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" - - TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" - - # shellcheck disable=SC2086 - docker exec "$CLI" peer chaincode invoke \\ - $PEER_ADDRESSES \\ - $TLS_ROOT_CERT_FILES \\ - -C "$CHANNEL" \\ - -n "$CHAINCODE" \\ - -c "$COMMAND" \\ - --transient "$TRANSIENT" \\ - --waitForEvent \\ - --waitForEventTimeout 90s \\ - --tls \\ - --cafile "/var/hyperledger/cli/$CA_CERT" \\ - 2>&1 -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -peerChannelList() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list -} - -peerChannelGetInfo() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" -} - -peerChannelFetchConfig() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlock() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local TARGET_FILE="$5" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} - -#=== TLS equivalents ========================================================= - -peerChannelListTls() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CA_CERT=$3 - - echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" -} - -peerChannelGetInfoTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local PEER_ADDRESS=$3 - local CA_CERT=$4 - - echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" -} - -peerChannelFetchConfigTls() { - local CHANNEL_NAME=$1 - local CLI_NAME=$2 - local CONFIG_FILE_NAME=$3 - local PEER_ADDRESS=$4 - local CA_CERT=$5 - - echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb - docker exec \\ - -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" configtxlator proto_decode \\ - --input /tmp/hyperledger/assets/config_block_before.pb \\ - --type common.Block | - jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ -} - -peerChannelFetchBlockTls() { - local CHANNEL_NAME="$1" - local CLI_NAME="$2" - local BLOCK_NAME="$3" - local PEER_ADDRESS="$4" - local CA_CERT="$5" - local TARGET_FILE="$6" - local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" - - echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." - inputLog "CHANNEL_NAME: $CHANNEL_NAME" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "BLOCK_NAME: $BLOCK_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "TARGET_FILE: $TARGET_FILE" - - docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ - - docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ - "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ - -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" - - docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" - - docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -set -eu - -createChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx - peer channel join -b "\${CHANNEL_NAME}".block - - rm -rf "$DIR_NAME" -} - -createChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Creating channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . - - peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoin() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local ORDERER_URL=$5 - - local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name: \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" - peer channel join -b "\${CHANNEL_NAME}"_newest.block - - rm -rf "$DIR_NAME" -} - -fetchChannelAndJoinTls() { - local CHANNEL_NAME=$1 - local CORE_PEER_LOCALMSPID=$2 - local CORE_PEER_ADDRESS=$3 - local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") - local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") - local TLS_CA_CERT_PATH=$(realpath "$6") - local ORDERER_URL=$7 - - local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt - local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key - local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt - - local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS - - echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" - echo " Orderer: $ORDERER_URL" - echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" - echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" - echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" - echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" - echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" - echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" - echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" - - mkdir "$DIR_NAME" && cd "$DIR_NAME" - - peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" - peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" - - rm -rf "$DIR_NAME" -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -__getOrdererAndPeerNodes() { - echo " - orderer0.group1.orderer.example.com - peer0.org1.example.com - " -} - -__getCASQLiteNodes() { - echo " - ca.orderer.example.com - " -} - -__getCAPostgresNodes() { - echo " - db.ca.org1.example.com - " -} - -__createSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" - - if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then - echo "Error: Directory '$backup_dir' already exists and is not empty!" - exit 1 - fi - - mkdir -p "$backup_dir" - cp -R ./fablo-target "$backup_dir/" - - for node in $(__getCASQLiteNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node" - docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" - done - - for node in $(__getCAPostgresNodes); do - echo "Saving state of $node..." - mkdir -p "$backup_dir/$node/pg-data" - docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Saving state of $node..." - docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" - done -} - -__cloneSnapshot() { - cd "$FABLO_NETWORK_ROOT/.." - target_dir="$1" - hook_cmd="$2" - - if [ -d "$target_dir/fablo-target" ]; then - echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." - exit 1 - fi - - cp -R ./fablo-target "$target_dir/fablo-target" - - if [ -n "$hook_cmd" ]; then - echo "Executing pre-restore hook: '$hook_cmd'" - (cd "$target_dir" && eval "$hook_cmd") - fi - - (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) - - for node in $(__getCASQLiteNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" - fi - done - - for node in $(__getCAPostgresNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" - fi - done - - for node in $(__getOrdererAndPeerNodes); do - echo "Restoring $node..." - if [ ! -d "$node" ]; then - echo "Warning: Cannot restore '$node', directory does not exist!" - else - docker cp "./$node/" "$node:/var/hyperledger/production/" - fi - done -} - -createSnapshot() { - (set -eu && __createSnapshot "$1") -} - -cloneSnapshot() { - (set -eu && __cloneSnapshot "$1" "$2") -} -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"#!/usr/bin/env bash - -# The code from this file was called after Fablo generated Hyperledger Fabric configuration -echo "Executing post-generate hook" - -perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" -" -`; - -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -[ - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", -] -`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index da36e4563..20661ba31 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1792,19 +1792,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 267586c91..f12e61e72 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2587,51 +2587,51 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com_or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com_or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com_or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com_or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com_and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com_and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com_and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com_and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 91e26c7ff..f8bb1ce99 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3711,35 +3711,35 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org2.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org2.example.com_chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org2.example.com_chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index e45a1c347..04ce4a1d6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3969,19 +3969,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index b44b127d3..49fd933c6 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1858,19 +1858,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 383666036..4d5c5582e 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1882,19 +1882,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5427131118e21d1392b51fd9acd0255b8330e003 GIT binary patch literal 6148 zcmeHK%}T>S5T0$Trc|K^g&r5YR_u=o;w4ml0V8@)sf`I5jM>s8_D~8r>kIiLK94iI zTd`Cx9z@Cv%zm@8Gg;Z0 zXwzMSP+D{?76x$zMVM4XlPc^LLzr~*OB?4}EDV}-5PD~Pj@?<<8;a1oqhIQ95UxQU znE_^Co`JHN)~WxW{(S$RPvRLfzzi%E1EO-`o%FCI+glfkqh2dfZ&67ot}ytSf`)Fz g7)!0VfvN@lk_<%GVqp+HDEuR!Y2bkw_)`Wx0F-i0-v9sr literal 0 HcmV?d00001 diff --git a/src/setup-docker/.DS_Store b/src/setup-docker/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..39a4d421f40b4149b873e2a876ffef65df33988d GIT binary patch literal 6148 zcmeHK-AcnS6i&A3T87XIg;F&!<`6 zpWNW+QpzMK`+jg0N3)@`dnVJ|kJD(P65=p|klX7x4dtvar)ij}Tu(bJ+p>pFb3X5M zdo6L)=`C7fe$s8X#9{Avv9PVZ{e#ns;Zrh7<%_11!=I;Q$6yJs&{?yxXK#`wGJODV znOSBK5(C5lF|a8NnDftSY|4UZox}h!@M8w>d=Q|BuE9d1Iy#`i>m&MWh$zsU74{%P{XhTy{lA<fW7Xd{BHN?QLGVlQ@0!@Da literal 0 HcmV?d00001 diff --git a/src/setup-docker/templates/.DS_Store b/src/setup-docker/templates/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fc06ccfc8195e4f441fd6cf9e2a2344905f407c2 GIT binary patch literal 8196 zcmeHMU2GIp6h3EKV6IS^^4HGtla(qUEV^xN6&hjNZuzwVyDj|zS!Z_!I$=6fW@dMh zrrN|96Myh0`lyL9@xds82NR<4!2}JwXo7@j^uY)8!51{qXyS|K-a88}e-Fl}fw{@O zXU;w6%$;-QJNNFH1pw?RnXLfL0H9LmRGUk~bsCrReoa%NnR=o~_5d~%VLh1O5sh0M zfj9zj1mXz95r`x3e~bW~*}SPYIQOMA9^(ka5x6ZQ!1sqFbxt!8osm>*9W;m%fG95k zM5Ak}1B6X7qM3-!NGeR}p0awt$P}Xz1Eo31lU$u>CZaQvN^?MI4j8SBQH6qHb+Ste zb-;|I@fb%Sj=;4M;OWx<2f%;=_%-$WA+W$NRD#KZ;}uBjRAJJwgD{=GfJ$Bctl4wa zIqF>XvD~;<$%RH(3VIBGFXsk5&nZ-|jlv$=s^qmry`CEywrlyqz&0&X**9#vrdR3l zO0F3Q+nf}rOl5hkd1|V)tv!|OXlJGnYy^;{;q-iA!ow%o|8^t zv@wu3we5LgZ{nd7lzXLzb&0BnUsXM1Y_2{$GCG#mv{GOVSdJ0eWh-lhR*=``2juMb zqUY}Rtui?|T=bmMgiDgfqTv)vq-=FNPR>4R1tXz#B;;3Pf#-+4LUF_?87BHd_t_TLQk@N zCOv$=XYy4{Rr`PmNsFG;_i{?A`a+qdHvrhJqK3tBx)pp9sF7~iKQuHP!$i;v>NXhAp-lOm5D?efc;jT%`+TITtNrsgFB zIh`yt+b!FKXnF|}*xET&Ra-J^C9XtlTQX_MEvf|@omVR8kb+IH1;*$rmOMrm+>9BuURC{E!tK8erb%lHbuhOgtB_&y%T6L=Co#82@vJcDQP9A3ol z@dvzwKjF{#hf=RJDY}wSmMY7Xdz7_GyYxb-=Fr|+uaqqDH_xGHmrxF0FNYFawr<=0 zpXAWj^F-DxSh#5Mik3C&+d8{4m(eBRSViDpaV@}HlL7+F;>}-$LJlT9!Imwr=GT?X zl9@I{SzsMeIh3_Ik@j6HRmuWwR>ZDaP3%r>wqz6QQYvMfrU;fL(yfg0N~??5bsfZ_ zWY~s{j518CkJwF{8Bcl*1fNLsX6a6+wSNG-Z^6580#3nc0`CR*2EKz!1Xv)zYPdvz zb}25$Rk#}0;95*!2X^9vxPjoC#Xj7E+i(YgcaY#ajH6hS0KW;y4(j^`dEttz-{Z*UuPb<+1{UjO&q`1}8D z9HH3tI0CnR1h77v%l43;H`*b2t(~O)ICb8*-i)Nega%QL6BXq+(aV1r(shzlxlJab bGm_E_wSWCXKz#oHjUTV^`7gkF3k`n)c>FhW literal 0 HcmV?d00001 diff --git a/src/setup-docker/templates/fabric-docker/.DS_Store b/src/setup-docker/templates/fabric-docker/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9ebe8388648db94a3b7aa0b5b41a7b9698119a01 GIT binary patch literal 6148 zcmeHKIS#@=477m)L_?R^35$VGX6?4j=a->{24G^XjI_W3fuuhBNbi% literal 0 HcmV?d00001 diff --git a/src/setup-docker/templates/fabric-docker/core.yaml b/src/setup-docker/templates/fabric-docker/core.yaml deleted file mode 100644 index 7c3148143..000000000 --- a/src/setup-docker/templates/fabric-docker/core.yaml +++ /dev/null @@ -1,777 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -############################################################################### -# -# Peer section -# -############################################################################### -peer: - - # The peer id provides a name for this peer instance and is used when - # naming docker resources. - id: jdoe - - # The networkId allows for logical separation of networks and is used when - # naming docker resources. - networkId: dev - - # The Address at local network interface this Peer will listen on. - # By default, it will listen on all network interfaces - listenAddress: 0.0.0.0:7051 - - # The endpoint this peer uses to listen for inbound chaincode connections. - # If this is commented-out, the listen address is selected to be - # the peer's address (see below) with port 7052 - # chaincodeListenAddress: 0.0.0.0:7052 - - # The endpoint the chaincode for this peer uses to connect to the peer. - # If this is not specified, the chaincodeListenAddress address is selected. - # And if chaincodeListenAddress is not specified, address is selected from - # peer address (see below). If specified peer address is invalid then it - # will fallback to the auto detected IP (local IP) regardless of the peer - # addressAutoDetect value. - # chaincodeAddress: 0.0.0.0:7052 - - # When used as peer config, this represents the endpoint to other peers - # in the same organization. For peers in other organization, see - # gossip.externalEndpoint for more info. - # When used as CLI config, this means the peer's endpoint to interact with - address: 0.0.0.0:7051 - - # Whether the Peer should programmatically determine its address - # This case is useful for docker containers. - # When set to true, will override peer address. - addressAutoDetect: false - - # Settings for the Peer's gateway server. - gateway: - # Whether the gateway is enabled for this Peer. - enabled: true - # endorsementTimeout is the duration the gateway waits for a response - # from other endorsing peers before returning a timeout error to the client. - endorsementTimeout: 30s - # dialTimeout is the duration the gateway waits for a connection - # to other network nodes. - dialTimeout: 2m - - - # Keepalive settings for peer server and clients - keepalive: - # Interval is the duration after which if the server does not see - # any activity from the client it pings the client to see if it's alive - interval: 7200s - # Timeout is the duration the server waits for a response - # from the client after sending a ping before closing the connection - timeout: 20s - # MinInterval is the minimum permitted time between client pings. - # If clients send pings more frequently, the peer server will - # disconnect them - minInterval: 60s - # Client keepalive settings for communicating with other peer nodes - client: - # Interval is the time between pings to peer nodes. This must - # greater than or equal to the minInterval specified by peer - # nodes - interval: 60s - # Timeout is the duration the client waits for a response from - # peer nodes before closing the connection - timeout: 20s - # DeliveryClient keepalive settings for communication with ordering - # nodes. - deliveryClient: - # Interval is the time between pings to ordering nodes. This must - # greater than or equal to the minInterval specified by ordering - # nodes. - interval: 60s - # Timeout is the duration the client waits for a response from - # ordering nodes before closing the connection - timeout: 20s - - - # Gossip related configuration - gossip: - # Bootstrap set to initialize gossip with. - # This is a list of other peers that this peer reaches out to at startup. - # Important: The endpoints here have to be endpoints of peers in the same - # organization, because the peer would refuse connecting to these endpoints - # unless they are in the same organization as the peer. - bootstrap: 127.0.0.1:7051 - - # NOTE: orgLeader and useLeaderElection parameters are mutual exclusive. - # Setting both to true would result in the termination of the peer - # since this is undefined state. If the peers are configured with - # useLeaderElection=false, make sure there is at least 1 peer in the - # organization that its orgLeader is set to true. - - # Defines whenever peer will initialize dynamic algorithm for - # "leader" selection, where leader is the peer to establish - # connection with ordering service and use delivery protocol - # to pull ledger blocks from ordering service. - useLeaderElection: false - # Statically defines peer to be an organization "leader", - # where this means that current peer will maintain connection - # with ordering service and disseminate block across peers in - # its own organization. Multiple peers or all peers in an organization - # may be configured as org leaders, so that they all pull - # blocks directly from ordering service. - orgLeader: true - - # Interval for membershipTracker polling - membershipTrackerInterval: 5s - - # Overrides the endpoint that the peer publishes to peers - # in its organization. For peers in foreign organizations - # see 'externalEndpoint' - endpoint: - # Maximum count of blocks stored in memory - maxBlockCountToStore: 10 - # Max time between consecutive message pushes(unit: millisecond) - maxPropagationBurstLatency: 10ms - # Max number of messages stored until a push is triggered to remote peers - maxPropagationBurstSize: 10 - # Number of times a message is pushed to remote peers - propagateIterations: 1 - # Number of peers selected to push messages to - propagatePeerNum: 3 - # Determines frequency of pull phases(unit: second) - # Must be greater than digestWaitTime + responseWaitTime - pullInterval: 4s - # Number of peers to pull from - pullPeerNum: 3 - # Determines frequency of pulling state info messages from peers(unit: second) - requestStateInfoInterval: 4s - # Determines frequency of pushing state info messages to peers(unit: second) - publishStateInfoInterval: 4s - # Maximum time a stateInfo message is kept until expired - stateInfoRetentionInterval: - # Time from startup certificates are included in Alive messages(unit: second) - publishCertPeriod: 10s - # Should we skip verifying block messages or not (currently not in use) - skipBlockVerification: false - # Dial timeout(unit: second) - dialTimeout: 3s - # Connection timeout(unit: second) - connTimeout: 2s - # Buffer size of received messages - recvBuffSize: 20 - # Buffer size of sending messages - sendBuffSize: 200 - # Time to wait before pull engine processes incoming digests (unit: second) - # Should be slightly smaller than requestWaitTime - digestWaitTime: 1s - # Time to wait before pull engine removes incoming nonce (unit: milliseconds) - # Should be slightly bigger than digestWaitTime - requestWaitTime: 1500ms - # Time to wait before pull engine ends pull (unit: second) - responseWaitTime: 2s - # Alive check interval(unit: second) - aliveTimeInterval: 5s - # Alive expiration timeout(unit: second) - aliveExpirationTimeout: 25s - # Reconnect interval(unit: second) - reconnectInterval: 25s - # Max number of attempts to connect to a peer - maxConnectionAttempts: 120 - # Message expiration factor for alive messages - msgExpirationFactor: 20 - # This is an endpoint that is published to peers outside of the organization. - # If this isn't set, the peer will not be known to other organizations. - externalEndpoint: - # Leader election service configuration - election: - # Longest time peer waits for stable membership during leader election startup (unit: second) - startupGracePeriod: 15s - # Interval gossip membership samples to check its stability (unit: second) - membershipSampleInterval: 1s - # Time passes since last declaration message before peer decides to perform leader election (unit: second) - leaderAliveThreshold: 10s - # Time between peer sends propose message and declares itself as a leader (sends declaration message) (unit: second) - leaderElectionDuration: 5s - - pvtData: - # pullRetryThreshold determines the maximum duration of time private data corresponding for a given block - # would be attempted to be pulled from peers until the block would be committed without the private data - pullRetryThreshold: 60s - # As private data enters the transient store, it is associated with the peer's ledger's height at that time. - # transientstoreMaxBlockRetention defines the maximum difference between the current ledger's height upon commit, - # and the private data residing inside the transient store that is guaranteed not to be purged. - # Private data is purged from the transient store when blocks with sequences that are multiples - # of transientstoreMaxBlockRetention are committed. - transientstoreMaxBlockRetention: 1000 - # pushAckTimeout is the maximum time to wait for an acknowledgement from each peer - # at private data push at endorsement time. - pushAckTimeout: 3s - # Block to live pulling margin, used as a buffer - # to prevent peer from trying to pull private data - # from peers that is soon to be purged in next N blocks. - # This helps a newly joined peer catch up to current - # blockchain height quicker. - btlPullMargin: 10 - # the process of reconciliation is done in an endless loop, while in each iteration reconciler tries to - # pull from the other peers the most recent missing blocks with a maximum batch size limitation. - # reconcileBatchSize determines the maximum batch size of missing private data that will be reconciled in a - # single iteration. - reconcileBatchSize: 10 - # reconcileSleepInterval determines the time reconciler sleeps from end of an iteration until the beginning - # of the next reconciliation iteration. - reconcileSleepInterval: 1m - # reconciliationEnabled is a flag that indicates whether private data reconciliation is enable or not. - reconciliationEnabled: true - # skipPullingInvalidTransactionsDuringCommit is a flag that indicates whether pulling of invalid - # transaction's private data from other peers need to be skipped during the commit time and pulled - # only through reconciler. - skipPullingInvalidTransactionsDuringCommit: false - # implicitCollectionDisseminationPolicy specifies the dissemination policy for the peer's own implicit collection. - # When a peer endorses a proposal that writes to its own implicit collection, below values override the default values - # for disseminating private data. - # Note that it is applicable to all channels the peer has joined. The implication is that requiredPeerCount has to - # be smaller than the number of peers in a channel that has the lowest numbers of peers from the organization. - implicitCollectionDisseminationPolicy: - # requiredPeerCount defines the minimum number of eligible peers to which the peer must successfully - # disseminate private data for its own implicit collection during endorsement. Default value is 0. - requiredPeerCount: 0 - # maxPeerCount defines the maximum number of eligible peers to which the peer will attempt to - # disseminate private data for its own implicit collection during endorsement. Default value is 1. - maxPeerCount: 1 - - # Gossip state transfer related configuration - state: - # indicates whenever state transfer is enabled or not - # default value is false, i.e. state transfer is active - # and takes care to sync up missing blocks allowing - # lagging peer to catch up to speed with rest network. - # Keep in mind that when peer.gossip.useLeaderElection is true - # and there are several peers in the organization, - # or peer.gossip.useLeaderElection is false alongside with - # peer.gossip.orgleader being false, the peer's ledger may lag behind - # the rest of the peers and will never catch up due to state transfer - # being disabled. - enabled: false - # checkInterval interval to check whether peer is lagging behind enough to - # request blocks via state transfer from another peer. - checkInterval: 10s - # responseTimeout amount of time to wait for state transfer response from - # other peers - responseTimeout: 3s - # batchSize the number of blocks to request via state transfer from another peer - batchSize: 10 - # blockBufferSize reflects the size of the re-ordering buffer - # which captures blocks and takes care to deliver them in order - # down to the ledger layer. The actual buffer size is bounded between - # 0 and 2*blockBufferSize, each channel maintains its own buffer - blockBufferSize: 20 - # maxRetries maximum number of re-tries to ask - # for single state transfer request - maxRetries: 3 - - # TLS Settings - tls: - # Require server-side TLS - enabled: false - # Require client certificates / mutual TLS for inbound connections. - # Note that clients that are not configured to use a certificate will - # fail to connect to the peer. - clientAuthRequired: false - # X.509 certificate used for TLS server - cert: - file: tls/server.crt - # Private key used for TLS server - key: - file: tls/server.key - # rootcert.file represents the trusted root certificate chain used for verifying certificates - # of other nodes during outbound connections. - # It is not required to be set, but can be used to augment the set of TLS CA certificates - # available from the MSPs of each channel’s configuration. - rootcert: - file: tls/ca.crt - # If mutual TLS is enabled, clientRootCAs.files contains a list of additional root certificates - # used for verifying certificates of client connections. - # It augments the set of TLS CA certificates available from the MSPs of each channel’s configuration. - # Minimally, set your organization's TLS CA root certificate so that the peer can receive join channel requests. - clientRootCAs: - files: - - tls/ca.crt - # Private key used for TLS when making client connections. - # If not set, peer.tls.key.file will be used instead - clientKey: - file: - # X.509 certificate used for TLS when making client connections. - # If not set, peer.tls.cert.file will be used instead - clientCert: - file: - - # Authentication contains configuration parameters related to authenticating - # client messages - authentication: - # the acceptable difference between the current server time and the - # client's time as specified in a client request message - timewindow: 15m - - # Path on the file system where peer will store data (eg ledger). This - # location must be access control protected to prevent unintended - # modification that might corrupt the peer operations. - fileSystemPath: /var/hyperledger/production - - # BCCSP (Blockchain crypto provider): Select which crypto implementation or - # library to use - BCCSP: - Default: SW - # Settings for the SW crypto provider (i.e. when DEFAULT: SW) - SW: - # TODO: The default Hash and Security level needs refactoring to be - # fully configurable. Changing these defaults requires coordination - # SHA2 is hardcoded in several places, not only BCCSP - Hash: SHA2 - Security: 256 - # Location of Key Store - FileKeyStore: - # If "", defaults to 'mspConfigPath'/keystore - KeyStore: - # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11) - PKCS11: - # Location of the PKCS11 module library - Library: - # Token Label - Label: - # User PIN - Pin: - Hash: - Security: - - # Path on the file system where peer will find MSP local configurations - mspConfigPath: msp - # Identifier of the local MSP - # ----!!!!IMPORTANT!!!-!!!IMPORTANT!!!-!!!IMPORTANT!!!!---- - # Deployers need to change the value of the localMspId string. - # In particular, the name of the local MSP ID of a peer needs - # to match the name of one of the MSPs in each of the channel - # that this peer is a member of. Otherwise this peer's messages - # will not be identified as valid by other nodes. - localMspId: SampleOrg - - # CLI common client config options - client: - # connection timeout - connTimeout: 3s - - # Delivery service related config - deliveryclient: - # Enables this peer to disseminate blocks it pulled from the ordering service - # via gossip. - # Note that 'gossip.state.enabled' controls point to point block replication - # of blocks committed in the past. - blockGossipEnabled: true - # It sets the total time the delivery service may spend in reconnection - # attempts until its retry logic gives up and returns an error - reconnectTotalTimeThreshold: 3600s - - # It sets the delivery service <-> ordering service node connection timeout - connTimeout: 3s - - # It sets the delivery service maximal delay between consecutive retries - reConnectBackoffThreshold: 3600s - - # A list of orderer endpoint addresses which should be overridden - # when found in channel configurations. - addressOverrides: - # - from: - # to: - # caCertsFile: - # - from: - # to: - # caCertsFile: - - # Type for the local MSP - by default it's of type bccsp - localMspType: bccsp - - # Used with Go profiling tools only in none production environment. In - # production, it should be disabled (eg enabled: false) - profile: - enabled: false - listenAddress: 0.0.0.0:6060 - - # Handlers defines custom handlers that can filter and mutate - # objects passing within the peer, such as: - # Auth filter - reject or forward proposals from clients - # Decorators - append or mutate the chaincode input passed to the chaincode - # Endorsers - Custom signing over proposal response payload and its mutation - # Valid handler definition contains: - # - A name which is a factory method name defined in - # core/handlers/library/library.go for statically compiled handlers - # - library path to shared object binary for pluggable filters - # Auth filters and decorators are chained and executed in the order that - # they are defined. For example: - # authFilters: - # - - # name: FilterOne - # library: /opt/lib/filter.so - # - - # name: FilterTwo - # decorators: - # - - # name: DecoratorOne - # - - # name: DecoratorTwo - # library: /opt/lib/decorator.so - # Endorsers are configured as a map that its keys are the endorsement system chaincodes that are being overridden. - # Below is an example that overrides the default ESCC and uses an endorsement plugin that has the same functionality - # as the default ESCC. - # If the 'library' property is missing, the name is used as the constructor method in the builtin library similar - # to auth filters and decorators. - # endorsers: - # escc: - # name: DefaultESCC - # library: /etc/hyperledger/fabric/plugin/escc.so - handlers: - authFilters: - - - name: DefaultAuth - - - name: ExpirationCheck # This filter checks identity x509 certificate expiration - decorators: - - - name: DefaultDecorator - endorsers: - escc: - name: DefaultEndorsement - library: - validators: - vscc: - name: DefaultValidation - library: - - # library: /etc/hyperledger/fabric/plugin/escc.so - # Number of goroutines that will execute transaction validation in parallel. - # By default, the peer chooses the number of CPUs on the machine. Set this - # variable to override that choice. - # NOTE: overriding this value might negatively influence the performance of - # the peer so please change this value only if you know what you're doing - validatorPoolSize: - - # The discovery service is used by clients to query information about peers, - # such as - which peers have joined a certain channel, what is the latest - # channel config, and most importantly - given a chaincode and a channel, - # what possible sets of peers satisfy the endorsement policy. - discovery: - enabled: true - # Whether the authentication cache is enabled or not. - authCacheEnabled: true - # The maximum size of the cache, after which a purge takes place - authCacheMaxSize: 1000 - # The proportion (0 to 1) of entries that remain in the cache after the cache is purged due to overpopulation - authCachePurgeRetentionRatio: 0.75 - # Whether to allow non-admins to perform non channel scoped queries. - # When this is false, it means that only peer admins can perform non channel scoped queries. - orgMembersAllowedAccess: false - - # Limits is used to configure some internal resource limits. - limits: - # Concurrency limits the number of concurrently running requests to a service on each peer. - # Currently this option is only applied to endorser service and deliver service. - # When the property is missing or the value is 0, the concurrency limit is disabled for the service. - concurrency: - # endorserService limits concurrent requests to endorser service that handles chaincode deployment, query and invocation, - # including both user chaincodes and system chaincodes. - endorserService: 2500 - # deliverService limits concurrent event listeners registered to deliver service for blocks and transaction events. - deliverService: 2500 - - # Since all nodes should be consistent it is recommended to keep - # the default value of 100MB for MaxRecvMsgSize & MaxSendMsgSize - # Max message size in bytes GRPC server and client can receive - maxRecvMsgSize: 104857600 - # Max message size in bytes GRPC server and client can send - maxSendMsgSize: 104857600 - -############################################################################### -# -# VM section -# -############################################################################### -vm: - - # Endpoint of the vm management system. For docker can be one of the following in general - # unix:///var/run/docker.sock - # http://localhost:2375 - # https://localhost:2376 - # If you utilize external chaincode builders and don't need the default Docker chaincode builder, - # the endpoint should be unconfigured so that the peer's Docker health checker doesn't get registered. - endpoint: unix:///var/run/docker.sock - - # settings for docker vms - docker: - tls: - enabled: false - ca: - file: docker/ca.crt - cert: - file: docker/tls.crt - key: - file: docker/tls.key - - # Enables/disables the standard out/err from chaincode containers for - # debugging purposes - attachStdout: false - - # Parameters on creating docker container. - # Container may be efficiently created using ipam & dns-server for cluster - # NetworkMode - sets the networking mode for the container. Supported - # standard values are: `host`(default),`bridge`,`ipvlan`,`none`. - # Dns - a list of DNS servers for the container to use. - # Note: `Privileged` `Binds` `Links` and `PortBindings` properties of - # Docker Host Config are not supported and will not be used if set. - # LogConfig - sets the logging driver (Type) and related options - # (Config) for Docker. For more info, - # https://docs.docker.com/engine/admin/logging/overview/ - # Note: Set LogConfig using Environment Variables is not supported. - hostConfig: - NetworkMode: host - Dns: - # - 192.168.0.1 - LogConfig: - Type: json-file - Config: - max-size: "50m" - max-file: "5" - Memory: 2147483648 - -############################################################################### -# -# Chaincode section -# -############################################################################### -chaincode: - - # The id is used by the Chaincode stub to register the executing Chaincode - # ID with the Peer and is generally supplied through ENV variables - # the `path` form of ID is provided when installing the chaincode. - # The `name` is used for all other requests and can be any string. - id: - path: - name: - - # Generic builder environment, suitable for most chaincode types - builder: $(DOCKER_NS)/fabric-ccenv:$(TWO_DIGIT_VERSION) - - # Enables/disables force pulling of the base docker images (listed below) - # during user chaincode instantiation. - # Useful when using moving image tags (such as :latest) - pull: false - - golang: - # golang will never need more than baseos - runtime: $(DOCKER_NS)/fabric-baseos:$(TWO_DIGIT_VERSION) - - # whether or not golang chaincode should be linked dynamically - dynamicLink: false - - java: - # This is an image based on java:openjdk-8 with addition compiler - # tools added for java shim layer packaging. - # This image is packed with shim layer libraries that are necessary - # for Java chaincode runtime. - runtime: $(DOCKER_NS)/fabric-javaenv:2.5 - - node: - # This is an image based on node:$(NODE_VER)-alpine - runtime: $(DOCKER_NS)/fabric-nodeenv:2.5 - - # List of directories to treat as external builders and launchers for - # chaincode. The external builder detection processing will iterate over the - # builders in the order specified below. - # If you don't need to fallback to the default Docker builder, also unconfigure vm.endpoint above. - # To override this property via env variable use CORE_CHAINCODE_EXTERNALBUILDERS: [{name: x, path: dir1}, {name: y, path: dir2}] - externalBuilders: - - name: ccaas_builder - path: /opt/hyperledger/ccaas_builder - propagateEnvironment: - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG - - - # The maximum duration to wait for the chaincode build and install process - # to complete. - installTimeout: 300s - - # Timeout duration for starting up a container and waiting for Register - # to come through. - startuptimeout: 300s - - # Timeout duration for Invoke and Init calls to prevent runaway. - # This timeout is used by all chaincodes in all the channels, including - # system chaincodes. - # Note that during Invoke, if the image is not available (e.g. being - # cleaned up when in development environment), the peer will automatically - # build the image, which might take more time. In production environment, - # the chaincode image is unlikely to be deleted, so the timeout could be - # reduced accordingly. - executetimeout: 30s - - # There are 2 modes: "dev" and "net". - # In dev mode, user runs the chaincode after starting peer from - # command line on local machine. - # In net mode, peer will run chaincode in a docker container. - mode: net - - # keepalive in seconds. In situations where the communication goes through a - # proxy that does not support keep-alive, this parameter will maintain connection - # between peer and chaincode. - # A value <= 0 turns keepalive off - keepalive: 0 - - # enabled system chaincodes - system: - _lifecycle: enable - cscc: enable - lscc: enable - qscc: enable - - # Logging section for the chaincode container - logging: - # Default level for all loggers within the chaincode container - level: info - # Override default level for the 'shim' logger - shim: warning - # Format for the chaincode container logs - format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' - -############################################################################### -# -# Ledger section - ledger configuration encompasses both the blockchain -# and the state -# -############################################################################### -ledger: - - blockchain: - - state: - # stateDatabase - options are "goleveldb", "CouchDB" - # goleveldb - default state database stored in goleveldb. - # CouchDB - store state database in CouchDB - stateDatabase: goleveldb - # Limit on the number of records to return per query - totalQueryLimit: 100000 - couchDBConfig: - # It is recommended to run CouchDB on the same server as the peer, and - # not map the CouchDB container port to a server port in docker-compose. - # Otherwise proper security must be provided on the connection between - # CouchDB client (on the peer) and server. - couchDBAddress: 127.0.0.1:5984 - # This username must have read and write authority on CouchDB - username: - # The password is recommended to pass as an environment variable - # during start up (eg CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD). - # If it is stored here, the file must be access control protected - # to prevent unintended users from discovering the password. - password: - # Number of retries for CouchDB errors - maxRetries: 3 - # Number of retries for CouchDB errors during peer startup. - # The delay between retries doubles for each attempt. - # Default of 10 retries results in 11 attempts over 2 minutes. - maxRetriesOnStartup: 10 - # CouchDB request timeout (unit: duration, e.g. 20s) - requestTimeout: 35s - # Limit on the number of records per each CouchDB query - # Note that chaincode queries are only bound by totalQueryLimit. - # Internally the chaincode may execute multiple CouchDB queries, - # each of size internalQueryLimit. - internalQueryLimit: 1000 - # Limit on the number of records per CouchDB bulk update batch - maxBatchUpdateSize: 1000 - # Create the _global_changes system database - # This is optional. Creating the global changes database will require - # additional system resources to track changes and maintain the database - createGlobalChangesDB: false - # CacheSize denotes the maximum mega bytes (MB) to be allocated for the in-memory state - # cache. Note that CacheSize needs to be a multiple of 32 MB. If it is not a multiple - # of 32 MB, the peer would round the size to the next multiple of 32 MB. - # To disable the cache, 0 MB needs to be assigned to the cacheSize. - cacheSize: 64 - - history: - # enableHistoryDatabase - options are true or false - # Indicates if the history of key updates should be stored. - # All history 'index' will be stored in goleveldb, regardless if using - # CouchDB or alternate database for the state. - enableHistoryDatabase: true - - pvtdataStore: - # the maximum db batch size for converting - # the ineligible missing data entries to eligible missing data entries - collElgProcMaxDbBatchSize: 5000 - # the minimum duration (in milliseconds) between writing - # two consecutive db batches for converting the ineligible missing data entries to eligible missing data entries - collElgProcDbBatchesInterval: 1000 - # The missing data entries are classified into two categories: - # (1) prioritized - # (2) deprioritized - # Initially, all missing data are in the prioritized list. When the - # reconciler is unable to fetch the missing data from other peers, - # the unreconciled missing data would be moved to the deprioritized list. - # The reconciler would retry deprioritized missing data after every - # deprioritizedDataReconcilerInterval (unit: minutes). Note that the - # interval needs to be greater than the reconcileSleepInterval - deprioritizedDataReconcilerInterval: 60m - - snapshots: - # Path on the file system where peer will store ledger snapshots - rootDir: /var/hyperledger/production/snapshots - -############################################################################### -# -# Operations section -# -############################################################################### -operations: - # host and port for the operations server - listenAddress: 127.0.0.1:9443 - - # TLS configuration for the operations endpoint - tls: - # TLS enabled - enabled: false - - # path to PEM encoded server certificate for the operations server - cert: - file: - - # path to PEM encoded server key for the operations server - key: - file: - - # most operations service endpoints require client authentication when TLS - # is enabled. clientAuthRequired requires client certificate authentication - # at the TLS layer to access all resources. - clientAuthRequired: false - - # paths to PEM encoded ca certificates to trust for client authentication - clientRootCAs: - files: [] - -############################################################################### -# -# Metrics section -# -############################################################################### -metrics: - # metrics provider is one of statsd, prometheus, or disabled - provider: disabled - - # statsd configuration - statsd: - # network type: tcp or udp - network: udp - - # statsd server address - address: 127.0.0.1:8125 - - # the interval at which locally cached counters and gauges are pushed - # to statsd; timings are pushed immediately - writeInterval: 10s - - # prefix is prepended to all emitted statsd metrics - prefix: \ No newline at end of file From 763bc85721492b0e4e46872581b179b4ddf2da34 Mon Sep 17 00:00:00 2001 From: Real-Artisan Date: Fri, 6 Jun 2025 11:15:01 -0500 Subject: [PATCH 307/471] fix-add fallback values for chaincodePackage arguments Signed-off-by: Real-Artisan Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/.DS_Store | Bin 8196 -> 8196 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/setup-docker/templates/.DS_Store b/src/setup-docker/templates/.DS_Store index fc06ccfc8195e4f441fd6cf9e2a2344905f407c2..ed8c70bd1de70c738a6eee376e0e1063ede3eca5 100644 GIT binary patch delta 1078 zcmd^7Nlz3(7_B$5RJlMAhXHIlLRcb;XhZ`jAP9;JOAL$*NWdPtkc!YF(>;TFa5TZF zi5ktsqf0dLXe7qOsNuvxH1Pm)^rVR=6E0lTxYSHT_z_;J^S!U$>#yGXW?E)iUR38m zi|@?29b;^(w?8Uv8JrLUhCM1QQ(9;J)6#Ut2c;=2M~+DmW-JH8eU>pP65N-UU$9Nn z+&k->HI+alD5oOQxyVZ>O>D`^=1eOpW|Y4gG7U#`h0LU)nd)dUt*DIB)5%6#Sg6y* znO0G$7)GBhF9}zJ)$C%7+kNMxwaR6+dnx0lf5Hfg30IEQHz?>te^i8R8M0Qvre>t%Ddq16?QtV4dZsNAUL|#OQaZx3 zQ+See*pyBvoHC`mNYe(AVy&hrO!fABUmn+bH9zHxio>N9m5$-4xq8(nV$+hA%J@od zbL;_mMxK+`WR5J559A~HM3%^B@`ZdSE95u%3j$yxHeoZeprI6HD90WgKqH!P5bfwf zH+paqr!ayuFfa;hkR6hc?_>_7#oP>p@4Lp}B@v)XY49XN*L=!IWd6~F+3Fd;C85T=x2 d4kF5~E4YdoT*DpQ#XZDdKK0FJ{Pz|Z_y?KT29*E+ delta 1038 zcmd^-%}Z2K7{<>tS)CJ@XGmw}Tq`U?OQ+C6%Oo39D>N~5CO;D8j`!Le(mOi$j+Rjq zWVGsYYFV40U7Bw|sChUjE z?)G2L_}M1bCk@kb0#m%zAc6 z^b93OM^#2!MF@L#L>v(VMn*k)LbsicG1GGAdhHck#4*ulC-jurF=?48%I7@4Rr!Ow zAXjnQS`6tVQ)=iOloD~0(q1=BqhXlFVtz0b=QYDA<_nb4(nv*i zrKllupFAS7T*EEg#$DXQ13bnP%wQJJ@dj@(hj}busSuy>1a$3`xnrWWe49_kX_4I=% z6dZvZj$&*<8OpH}6$qmSwb+k31*RD-IEv$FRal}5OgDNF#}Et!Cy6nP!$w-6$>1`s V;3{t5rh;_m>BGS6y8kM!jz8=P^=kkC From 2943f6b81cc3989f3d9be2ecc529be7942eb78a1 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 28 Apr 2025 18:41:06 +0200 Subject: [PATCH 308/471] Fix tag format for release CI (#504) Signed-off-by: Pereowei Daniel From 72034abf8bbd7ec652558dc32553f4348b925f9b Mon Sep 17 00:00:00 2001 From: Kalio <89003403+kalio007@users.noreply.github.com> Date: Mon, 28 Apr 2025 18:47:51 +0100 Subject: [PATCH 309/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 45d5d2c8acd9589392042e2d1f13b16afcd0f34b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:43 -0500 Subject: [PATCH 310/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 571fa79a94c470af24cf6362a3972b445e4a3ed5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:46 -0500 Subject: [PATCH 311/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 75b12df87d9c2f387efd3aa839978a36764f1a70 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:50 -0500 Subject: [PATCH 312/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 810946374f7b738357fb356047c414db45f4fbb6 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:51 -0500 Subject: [PATCH 313/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0073a4bcf1b25d395b1c0ebd26e04fc76aab6a85 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:53 -0500 Subject: [PATCH 314/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 2d8c1c80106dad65531ac6ee4dbd0d3c85ab1eea Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:54 -0500 Subject: [PATCH 315/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 7ed0ca9726015e3669cef300ea8c4a2f915643dd Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:54 -0500 Subject: [PATCH 316/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 145f88c7b76718a2eb31d4254767c5cf764f832f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:55 -0500 Subject: [PATCH 317/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6e01bc7ad392e3c268df32feeadd27cafdfdaff7 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:56 -0500 Subject: [PATCH 318/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ca767d0bde77b6fa875f5e50c88ff6dbc2495fa0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:57 -0500 Subject: [PATCH 319/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5a500ccacd89cf8216f5f15233220587f6be9ae3 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:58 -0500 Subject: [PATCH 320/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ce5e12198562767eea03b5fe0e07e4906e60ba13 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:37:59 -0500 Subject: [PATCH 321/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c8646c11954eb4077367700a0a4ccbf9b5a5b18c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:01 -0500 Subject: [PATCH 322/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 69075f525c814553a81076708476514a4f05ff88 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:02 -0500 Subject: [PATCH 323/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6af17ceaf008279ce6efa8a2803f2b988f083bb2 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:03 -0500 Subject: [PATCH 324/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From df5b0111603b435bcdd420b485e56e24620d2721 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:04 -0500 Subject: [PATCH 325/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a6b0949bef69629a3c88ab61144d80e0985c3664 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:05 -0500 Subject: [PATCH 326/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3c769bf2bca16f8367597a70b4c780dcfb8c6c29 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:06 -0500 Subject: [PATCH 327/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 102d0ce187dc5fd3a2ab2ad938ea333f2c12d6ad Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:06 -0500 Subject: [PATCH 328/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 694c63432ff7a70bda716e592994bb5929e7999a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:07 -0500 Subject: [PATCH 329/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c88965434de327c5e9d83458d4d91ec8f6300bd6 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:08 -0500 Subject: [PATCH 330/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8e4a90af2ce54eca536525f7fd8dc637786fd662 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:09 -0500 Subject: [PATCH 331/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From aa9ed84a4150c0d365ad7e4b17ece15156e31a37 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:10 -0500 Subject: [PATCH 332/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 16d2a5f0601c970f8b6e29f43910f65d996b6ab5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:11 -0500 Subject: [PATCH 333/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0c1f80c6e1bc9bef5ae493e98fb1bf9400f9a644 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:11 -0500 Subject: [PATCH 334/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c61f274f9ff37de984f7e86a6766e659558e7cf4 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:12 -0500 Subject: [PATCH 335/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From bd7e905be8efa7f928c8d311b02c10b5198d006d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:14 -0500 Subject: [PATCH 336/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 023218b37a7d7ffdfa98df31b6b4492fb4501799 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:15 -0500 Subject: [PATCH 337/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e5a56d4c47249152a3675508d1c839d4b3c42611 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:15 -0500 Subject: [PATCH 338/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ae49ebc39fd2247571929c4fe1fde4dfdd7df07e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:16 -0500 Subject: [PATCH 339/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 09087d361e8359c9f158d08feba6cd9e53c8e517 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:17 -0500 Subject: [PATCH 340/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 1aa5cb83420595f1f962542190697535103bcfe1 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:17 -0500 Subject: [PATCH 341/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c7fa88f085dd8d8994c1549064c82eff0b83ed50 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:19 -0500 Subject: [PATCH 342/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b450252099f6de375ec4b3794dd4bf2e93d4aa32 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:20 -0500 Subject: [PATCH 343/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 5ac72d2406e502293a0f5033dcd40599cc4c415b Mon Sep 17 00:00:00 2001 From: Ronald L <35465493+ronaldl29@users.noreply.github.com> Date: Wed, 30 Apr 2025 12:10:42 -0400 Subject: [PATCH 344/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d4235539b72f9ce3a1a2900d33f6f96c8492ad66 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:38:59 -0500 Subject: [PATCH 345/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f091951593da73543b254781eb44fdebd5e88521 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:03 -0500 Subject: [PATCH 346/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8858c440e963e07baef2add411d2dfa5f5b53075 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:05 -0500 Subject: [PATCH 347/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 4839308258c2128ef17a0c8a9bd015e8064eb438 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:06 -0500 Subject: [PATCH 348/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b52fd8209ea3ed5977ae117eb1d9a8cc7224836f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:07 -0500 Subject: [PATCH 349/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d9e4249c59d10d8697bbd8baa182210d2f5f18fe Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:08 -0500 Subject: [PATCH 350/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ba38acd20f9d70f393e8479f3a4c601fe66cc6e3 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:09 -0500 Subject: [PATCH 351/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 00b7aa63084f2e98345d043e22df22a7913ceb4e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:10 -0500 Subject: [PATCH 352/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 0f54dc24346dfed574d564c4df9de36d6fd4f584 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:11 -0500 Subject: [PATCH 353/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ba15d9aa8bb86e47f52b98c60ca98bfd3841a934 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:12 -0500 Subject: [PATCH 354/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 31fd0a2ea6659328b5f42c267e6162022b395a55 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:13 -0500 Subject: [PATCH 355/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8eb39b1518f8f57b6ae85595df33d3f237030aaa Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:14 -0500 Subject: [PATCH 356/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 51b7f2958f244064e69f3aeebe3a582a552a4d39 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:15 -0500 Subject: [PATCH 357/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 4325d2c6c28a957bdc1a25aff9dbf703381ad3c4 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:16 -0500 Subject: [PATCH 358/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 856825ab7155df827347a74aa248324809ce84d1 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:17 -0500 Subject: [PATCH 359/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9af0ae737c8050375a58cb3190ec95b9a2021587 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:17 -0500 Subject: [PATCH 360/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From cebad909ed3f567b0f4b0961ab18229f1365b28e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:18 -0500 Subject: [PATCH 361/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 79b2b5d3997acef86294eb54994efaa013a2ddbe Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:19 -0500 Subject: [PATCH 362/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 111418781629db9fc6fcf0c75bf7e0031d1a9fb2 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:19 -0500 Subject: [PATCH 363/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 651345315e0295cc122fb447965384862a90029b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:21 -0500 Subject: [PATCH 364/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 010bddab0d122cd2f14b64d220f5334b08119b14 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:22 -0500 Subject: [PATCH 365/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 83a4a75e9a9b89ea6ca0a4d117d3e66ecdb7edaf Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:23 -0500 Subject: [PATCH 366/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 32bf1394a412dc7c669600fd0d13a03f5a76a179 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:24 -0500 Subject: [PATCH 367/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From de44c5922b23ace105901329c065a92734c9f81f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:25 -0500 Subject: [PATCH 368/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 43485a000d7a80e8a45b7b520ef3f5fa73352978 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:26 -0500 Subject: [PATCH 369/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 24215399cb898715c5226c53dccfcf34b519687f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:28 -0500 Subject: [PATCH 370/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 691220d8876d496b87310f50b03d749e5b01920c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:29 -0500 Subject: [PATCH 371/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 3eb01111ca5f9f4fe8cdc04903b70b79662ee243 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:30 -0500 Subject: [PATCH 372/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f640b093501e716cd3510afc4801cfd81bc94288 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:31 -0500 Subject: [PATCH 373/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 36d1bd989b3359ad1ec6c564783239adca5076b5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:32 -0500 Subject: [PATCH 374/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 33e6ae15e827cf1b7ab0d43a49ae68adf5d2e9bb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:34 -0500 Subject: [PATCH 375/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b650f088aed22687645f0b5e2cc752e226c3e6e6 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:35 -0500 Subject: [PATCH 376/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 811153c5442eab305a62a57f9c92632cc39f55fb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:48 -0500 Subject: [PATCH 377/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 8de917a9e337eac62fb1b10e8d6ec2f544b66904 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:55 -0500 Subject: [PATCH 378/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From b32ecf504a1838328e1ea513ac05ffd8f35879f6 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:57 -0500 Subject: [PATCH 379/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f5852bdb9f7c5b08cea1dca808fd5a310b9802ea Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:39:59 -0500 Subject: [PATCH 380/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6350ee833be4763b41fdb684cc574666fa6bba4e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:03 -0500 Subject: [PATCH 381/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 18a6a07aa36ef1f04599189043905d5d70d91fae Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:06 -0500 Subject: [PATCH 382/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 767e2a11863a36b0d58f1d785108b806a170d2dc Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:08 -0500 Subject: [PATCH 383/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a8ef5c11a25e1a8194760113c53272c1d7ba7eaa Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:09 -0500 Subject: [PATCH 384/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9a6ad938e215f09166cca3c484b068eb33f064c0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:10 -0500 Subject: [PATCH 385/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 153d6e5951fa5641ce929f129ca9abfbee747bfe Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:12 -0500 Subject: [PATCH 386/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 400514dffb0d550cd1186a44fb12a74ff72d8ad0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:13 -0500 Subject: [PATCH 387/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f2321c69f7ff4c3446a062fa64ea19c50bb05c58 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:14 -0500 Subject: [PATCH 388/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e4cf1ef63268255a3b567ad0a2ffa65f2d02e3ed Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:15 -0500 Subject: [PATCH 389/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6dad434da7626d480a5cf94be04f288095678ec8 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:16 -0500 Subject: [PATCH 390/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 18ed0e59753b28ef3435e4517048ff8e56f1310e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:17 -0500 Subject: [PATCH 391/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e8eb53768da3f6b3e231f3b8a500985a52c75194 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:18 -0500 Subject: [PATCH 392/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e95c29c78d50b5f2e4754840714c442bba49395c Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:20 -0500 Subject: [PATCH 393/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6370a8f1bb58d20d0792d481a3a81c575a742b41 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:21 -0500 Subject: [PATCH 394/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c5403912a448208ce4322afb0ed3bc5f647efa11 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:40:22 -0500 Subject: [PATCH 395/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 9236b23b9c30c87774a676eb420c79b4247f5d1d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:15 -0500 Subject: [PATCH 396/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 64b0b4586ac9037c71a7933d93e8707f1e40aaac Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:17 -0500 Subject: [PATCH 397/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From fdba647cb8662072273e1ceeb1be317e724e4e7a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:18 -0500 Subject: [PATCH 398/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6bd5b7e27844f57e8ce3674b8a92d00201b9e4db Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:19 -0500 Subject: [PATCH 399/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 312e88d63d74e317627f2a2328f5ad9fffd3bafb Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:19 -0500 Subject: [PATCH 400/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From bec171e737bd040f774bae63a9cc91003a018e8e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:20 -0500 Subject: [PATCH 401/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 4d44e28bbe3b79274ab5bccb77f69d31e1f2ce35 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:21 -0500 Subject: [PATCH 402/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 1cffcf53574617b488f0226ce9e4c6fe686918ab Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:22 -0500 Subject: [PATCH 403/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 18c7ff30fc33665465d79882fbd83a6e138532c5 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:23 -0500 Subject: [PATCH 404/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 820442beb69cc9162ea23a272984883c7397c2fe Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:24 -0500 Subject: [PATCH 405/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 31903ad141ecf5762bf2f4f8b6ec3be4059fe251 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:24 -0500 Subject: [PATCH 406/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d9446f6aecc8cd789c92917f11472f4994941d77 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:25 -0500 Subject: [PATCH 407/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d9c6b34bbed6f8888fabbbed398c0865d2b83976 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:26 -0500 Subject: [PATCH 408/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 33e2ea6af71658ebbad82ad56394d0aca66896ea Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:27 -0500 Subject: [PATCH 409/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d7155ff9ad08d28632c13d09e228704d435b7334 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:28 -0500 Subject: [PATCH 410/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e114ed184cca6fbc3fdec25972115e26373828c3 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:29 -0500 Subject: [PATCH 411/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 1c7d52582c39f7f716f8dfd68ed45ec1591dac0f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:30 -0500 Subject: [PATCH 412/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d847bc361516e0a45eba3bcc08174efcb75567e8 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:30 -0500 Subject: [PATCH 413/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From de9a9f3407eb33553ce64766cce554c7196cf943 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:31 -0500 Subject: [PATCH 414/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 63d57feb9822e08f21e97d0e7074fcc83e341bef Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:32 -0500 Subject: [PATCH 415/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a788ba78d4583cc5b9b83cee308d336c71ae3a78 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:33 -0500 Subject: [PATCH 416/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6c9160274e273208265b45aad5621a5fe123b81b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:34 -0500 Subject: [PATCH 417/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 7d74f04252c8c9f9675ec5af0008dc5cdfcc3945 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:35 -0500 Subject: [PATCH 418/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 2435d7c4b2facd2d9d46d460c12743848223d59b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:36 -0500 Subject: [PATCH 419/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From f4ff7fa2abda95d84e9cdf47e227686aa27803a2 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:36 -0500 Subject: [PATCH 420/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 2e057750202bc0f2e5a656527877f3face4654d3 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:37 -0500 Subject: [PATCH 421/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From d94190188853b9f9ad104ad8acd78636d838c585 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:38 -0500 Subject: [PATCH 422/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From ffbf37ecacc849ff795c662b8e0fa0ec8c93f51f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:39 -0500 Subject: [PATCH 423/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e300d13f3d5d9f719ffc71e4b0d065f52c98bc96 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:40 -0500 Subject: [PATCH 424/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From e0433064d33a19bca3435648f08f6f2c22897a2f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:41 -0500 Subject: [PATCH 425/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From a6e4f2fb7b12257f2052c5ec46c269eaa219771a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:41 -0500 Subject: [PATCH 426/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 6a3ab5bfe57edb48abcda2f423915e66d7cc40c0 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:42 -0500 Subject: [PATCH 427/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 54af83597c528f4fa008e2618b6338b954f85e7d Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:43 -0500 Subject: [PATCH 428/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From bac2888de242ee0e5b1a1217c22c1b174161f7dc Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:44 -0500 Subject: [PATCH 429/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From 1f4162e258c70416986982efe5a00b542d14eae3 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:45 -0500 Subject: [PATCH 430/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel From c452b00a96f6e4725acadbcd2bfc0d83a929055b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 13:42:46 -0500 Subject: [PATCH 431/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel fix-update test suites for code changes Signed-off-by: Pereowei Daniel Fix-review comments and file changes Signed-off-by: Pereowei Daniel Fix-updated test suites for new code changes Signed-off-by: Pereowei Daniel fix-validate json schema Signed-off-by: Pereowei Daniel fix-re-enable explorer test and update changelog Signed-off-by: Pereowei Daniel fix-add .DS_STORE to gitignore Signed-off-by: Pereowei Daniel fix-increase validation warning count Signed-off-by: Pereowei Daniel generate certs using openssl for cc container Signed-off-by: Pereowei Daniel feat-generate-tls-certs-for-ccaass-container Signed-off-by: Pereowei Daniel feat-prepare-main-for-ccaas-tls-issue Signed-off-by: Pereowei Daniel --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 2 +- e2e-network/TEST_CASES.md | 2 +- e2e/__snapshots__/extendConfig.test.ts.snap | 258 +++++++++++++++--- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 137 +++++++++- ...2chaincodes-private-data.yaml.test.ts.snap | 171 ++++++++++-- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 163 +++++++++-- ...1chaincode-raft-explorer.json.test.ts.snap | 137 +++++++++- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 137 +++++++++- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 137 +++++++++- e2e/fabloCommands.test.ts | 2 +- src/.DS_Store | Bin 6148 -> 0 bytes src/extend-config/extendChaincodesConfig.ts | 3 +- src/setup-docker/.DS_Store | Bin 6148 -> 0 bytes src/setup-docker/templates/.DS_Store | Bin 8196 -> 0 bytes .../templates/fabric-docker/.DS_Store | Bin 6148 -> 0 bytes .../fabric-docker/commands-generated.sh | 13 + .../chaincode-install-v2.sh | 6 +- .../fabric-docker/docker-compose.yaml | 7 +- .../scripts/base-functions-v2.sh | 41 +++ .../scripts/base-functions-v3.sh | 41 +++ .../scripts/chaincode-functions-v2.sh | 83 +++++- src/validate/index.ts | 11 + 23 files changed, 1223 insertions(+), 128 deletions(-) delete mode 100644 .DS_Store delete mode 100644 src/.DS_Store delete mode 100644 src/setup-docker/.DS_Store delete mode 100644 src/setup-docker/templates/.DS_Store delete mode 100644 src/setup-docker/templates/fabric-docker/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 47ebe4e7c27facc40cf842f489774b8eefb01b5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%SyvQ6rE|SO({Ya3SADkE!c+&;wHrU14eYAQWH}&7&9eF&7u^t)*tdq{2uR} znSjNtMeMyWbMA8{b0G6zjB$4n4jHo7tD;G(asaj75td7;0+P&p+I2!lG(Qv%#i{;5^&=-f} z0&UQD0kmqfm4IytbdWXE6y@1U5~yn1O8%j6L}Rd$s{NDL4I!~ij{*$kL- z!Rl@{4YYbbTmFH`%-UoRnx z7$64z83VjE@g^=T%ABn~mWOApfOZcJ1@lT&KtNx+1b~72NKXZIT%Znlj=@qRj)Hzw Q4oDXPMF@4oz%MZH1!K!ed;kCd diff --git a/.gitignore b/.gitignore index 52740672f..e630d9167 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ node_modules .idea .vscode samples/invalid-fablo-config.json -.DS_Store \ No newline at end of file +**/.DS_Store \ No newline at end of file diff --git a/e2e-network/TEST_CASES.md b/e2e-network/TEST_CASES.md index 68ccbeb99..f59a8b921 100644 --- a/e2e-network/TEST_CASES.md +++ b/e2e-network/TEST_CASES.md @@ -19,4 +19,4 @@ | Java chaincode | no | yes | no | no | no | no | | Go chaincode | no | no | no | no | no | no | | Tools | channel scripts | Fablo REST | - | Fablo REST, Explorer, CCAAS | - | - | -| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | +| Other Fablo commands | init, reset | stop, start | - | snapshot, prune, restore | - | - | diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index d72aa5fbc..f422884a2 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1725,7 +1725,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -1851,14 +1867,30 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", }, - "directory": undefined, + "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1924,17 +1956,27 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, - "lang": "ccaas", + "lang": "node", "name": "chaincode1", - "peerChaincodeInstances": [ - { - "containerName": "peer0.org1.example.com_chaincode1", - "peerAddress": "peer0.org1.example.com", - "port": 7052, - }, - ], + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -2006,7 +2048,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -2132,7 +2190,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", @@ -2163,7 +2237,12 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "fabloConfig": "", }, "tls": true, - "tools": {}, + "tools": { + "explorer": { + "address": "explorer.example.com", + "port": 7010, + }, + }, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -2358,7 +2437,23 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], } @@ -11062,7 +11157,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -11188,14 +11299,30 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", }, - "directory": undefined, + "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11261,17 +11388,27 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, - "lang": "ccaas", + "lang": "node", "name": "chaincode1", - "peerChaincodeInstances": [ - { - "containerName": "peer0.org1.example.com_chaincode1", - "peerAddress": "peer0.org1.example.com", - "port": 7052, - }, - ], + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11343,7 +11480,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, "name": "my-channel1", "ordererGroup": { @@ -11469,7 +11622,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], "profileName": "MyChannel1", @@ -11500,7 +11669,12 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "fabloConfig": "", }, "tls": true, - "tools": {}, + "tools": { + "explorer": { + "address": "explorer.example.com", + "port": 7010, + }, + }, }, "hooks": { "postGenerate": "perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml"", @@ -11695,7 +11869,23 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, ], "peersCount": 1, - "tools": {}, + "tools": { + "fabloRest": { + "address": "fablo-rest.org1.example.com", + "discoverySslTargetNameOverrides": "", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "fabricCaName": "ca.org1.example.com", + "fabricCaUrl": "https://ca.org1.example.com:7054", + "logging": { + "error": "console", + "info": "console", + "warn": "console", + }, + "mspId": "Org1MSP", + "port": 8801, + }, + }, }, ], } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 20661ba31..9e0d26142 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1675,7 +1675,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" else @@ -1705,7 +1705,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1753,7 +1753,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1792,19 +1792,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -2077,6 +2077,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2441,7 +2482,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -2470,8 +2511,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2506,6 +2572,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2518,6 +2631,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2530,6 +2644,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2564,6 +2679,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index f12e61e72..12f206963 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2391,10 +2391,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" else @@ -2408,10 +2408,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" else @@ -2441,10 +2441,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2460,10 +2460,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2523,10 +2523,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2542,10 +2542,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "node" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2587,51 +2587,51 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com_or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com_or-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com_and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com_and-policy-chaincode*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -3005,6 +3005,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -3369,7 +3410,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -3398,8 +3439,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -3434,6 +3500,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3446,6 +3559,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -3458,6 +3572,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -3492,6 +3607,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index f8bb1ce99..9eeeb2dc7 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3508,10 +3508,10 @@ installChaincodes() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" else @@ -3524,10 +3524,10 @@ installChaincodes() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" else @@ -3556,10 +3556,10 @@ installChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3574,10 +3574,10 @@ installChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3636,10 +3636,10 @@ upgradeChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3654,10 +3654,10 @@ upgradeChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3711,35 +3711,35 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer0.org2.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org2.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode2*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org2.example.com_chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org2.example.com_chaincode2*" -q); do + for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -4408,6 +4408,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -4772,7 +4813,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -4801,8 +4842,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -4837,6 +4903,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4849,6 +4962,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -4861,6 +4975,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -4895,6 +5010,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 04ce4a1d6..123b5783f 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3843,7 +3843,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -3873,7 +3873,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3921,7 +3921,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3969,19 +3969,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -4908,6 +4908,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -5272,7 +5313,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -5301,8 +5342,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -5337,6 +5403,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5349,6 +5462,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -5361,6 +5475,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -5395,6 +5510,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 49fd933c6..48fac71c5 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1760,7 +1760,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -1790,7 +1790,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1826,7 +1826,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1858,19 +1858,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -2318,6 +2318,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2688,7 +2729,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -2717,8 +2758,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2753,6 +2819,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2765,6 +2878,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2777,6 +2891,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2811,6 +2926,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 4d5c5582e..28629b62a 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1784,7 +1784,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -1814,7 +1814,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1850,7 +1850,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1882,19 +1882,19 @@ networkDown() { (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "peer0.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer0.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com_chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "peer1.org1.example.com_chaincode1*" -q); do + for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done @@ -2342,6 +2342,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2712,7 +2753,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -2741,8 +2782,33 @@ chaincodePackageCaas() { echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\\"address\\":\\"\${PEER_ADDRESS}_\${CHAINCODE_NAME}:\${CONTAINER_PORT}\\",\\"dial_timeout\\":\\"10s\\",\\"tls_required\\":$TLS_ENABLED}" >"$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -2777,6 +2843,53 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2789,6 +2902,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2801,6 +2915,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2835,6 +2950,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 946f66015..361c0c3f4 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -96,7 +96,7 @@ describe("validate", () => { // Then expect(commandResult).toEqual(TestCommands.success()); expect(commandResult.output).toContain("Validation errors count: 0"); - expect(commandResult.output).toContain("Validation warnings count: 1"); + expect(commandResult.output).toContain("Validation warnings count: 2"); expect(commands.getFiles()).toEqual([]); }); diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 5427131118e21d1392b51fd9acd0255b8330e003..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5T0$Trc|K^g&r5YR_u=o;w4ml0V8@)sf`I5jM>s8_D~8r>kIiLK94iI zTd`Cx9z@Cv%zm@8Gg;Z0 zXwzMSP+D{?76x$zMVM4XlPc^LLzr~*OB?4}EDV}-5PD~Pj@?<<8;a1oqhIQ95UxQU znE_^Co`JHN)~WxW{(S$RPvRLfzzi%E1EO-`o%FCI+glfkqh2dfZ&67ot}ytSf`)Fz g7)!0VfvN@lk_<%GVqp+HDEuR!Y2bkw_)`Wx0F-i0-v9sr diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index fcbb81c97..1861dfec6 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -61,9 +61,10 @@ const extendChaincodesConfig = ( const peerChaincodeInstances = !chaincode.image ? [] : channel.orgs.flatMap((org) => org.peers.map((peer) => { return { - containerName: `${peer.address}_${chaincode.name}`, + containerName: `${chaincode.name}_${peer.address}`, peerAddress: peer.address, port: portCounter++, + orgDomain: org.domain }; }) ); diff --git a/src/setup-docker/.DS_Store b/src/setup-docker/.DS_Store deleted file mode 100644 index 39a4d421f40b4149b873e2a876ffef65df33988d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK-AcnS6i&A3T87XIg;F&!<`6 zpWNW+QpzMK`+jg0N3)@`dnVJ|kJD(P65=p|klX7x4dtvar)ij}Tu(bJ+p>pFb3X5M zdo6L)=`C7fe$s8X#9{Avv9PVZ{e#ns;Zrh7<%_11!=I;Q$6yJs&{?yxXK#`wGJODV znOSBK5(C5lF|a8NnDftSY|4UZox}h!@M8w>d=Q|BuE9d1Iy#`i>m&MWh$zsU74{%P{XhTy{lA<fW7Xd{BHN?QLGVlQ@0!@Da diff --git a/src/setup-docker/templates/.DS_Store b/src/setup-docker/templates/.DS_Store deleted file mode 100644 index ed8c70bd1de70c738a6eee376e0e1063ede3eca5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMTWl0n82WRu@YN&;q69eqGvyQlwPamR>-X*_{C>@G?$ zHPLuOqER2cCq5WM^udI9;fV*)#0O}IMjwn1KAG_1gO_;u&zxCsxjks22IeH^{PUml ze`n_Z=lf^&p9KKyC>YBD8UTP%7gDXI;U-P2i+)2>qM2%vNO%AX@~{L9a7o53jzAoN zI0A75;t0eM_&-K~-r1tDTfFz>YCOgfh$C=UMnF6tlGKGvMRH8a@XCZ&V}N;qJ2W{fHn49`xuWM~eU zk}@9S2*eS%F#;leCc`1nAqQSX{eBco@Ny-8G-taxvO1d^wJkqrZM}?2RrQ34HLQl! zvWGH9+)^gcgM#0od;5ge=el;Te5~j8T4pJ$)^)m0pj(dVg#gPi$z=b4W%iG#pk}H?DpKM8f}kz>Km7>-;+IRk2vl#(kYA{ z4CGB^dzRGOcxd~@PU&IQoU(^smObRWRvQ=`8qTU}!8iAqwjNkTGpz@vpH-*&jP2vwM83b4d5|rej#n;r^0k z1V@G`c1~a&vP_TjX?UQ|(MQa2b>^&w*>f~a+FZkwcNr|?tYZZ$cvx*@OrAqa&f`q| zV81~Q^tguD(Fj*GE!o7_J~7|vnKa62t}R+j0KLyAXQInox{Pzx?>kC2SVDRG3dU8V z-_~=c9ZjuSOH&UF6s5<}#rD_?ipQ#rK zqgqbUB39FlkmP2Ksl}34VOSeetx~J2Bpbc27|ezi*aX{Pn7)EJP=ZtN9Gr$%;B7bq zXW<-NfY0D__yR7$H}D<&06)TS@CO1S-h;I`38$cj^RWpRU>mN-4Y(0EV;XyK7xv2Q}h&txcLJxfmu!xW1llT-qji>Nsd=+2A*YQn!A3wy8@MAoO7w{rp!g2f_ui(%4 z3;wE9D-)C&g(;dcS7}lfEA7$?rJO_iD!o$Dq~AV=qNjv%>}ENX*w(eZ`#;H{uO^AC znKpe!UH!d{3zxL5TA#W~EJ?*O`~J%6kjNGE4~ZP!`Rf@NrWc=^=qIL|$FJp=%(rru zsWpPrY+P91$LA%~36u*`ozE8})QOY_QeBj2PN)i{pH!D7TDe+9$;Cr#d!m`E$fUBG zujOhrrI}PW@J(C=k@-^JlITpRB5Bw^C+{2Z4!lR?Jx}Dl3}3^ya0PyX-;ohnXJP}+ z#<`dv!Y;%`*o-Z>5?A9ITu1ax<2LNVZrp(x>?iUL;t=N0Kobw4i^qt<0TzhBWB3?8 zj!)oed>&uG7xAT#%5UMj*HLpvB{lJr+f%cc@f_QA4wF@x+?5;L#afm0y+PFfTW|gS z|1OSD?0Ou5J3j(gozA2?$j@6nAw{j7q<)aPXu@tx$`C?BSdNnn%W;xd|1hNEB$*0K dDw1PT(hRkK{X;?R^35$VGX6?4j=a->{24G^XjI_W3fuuhBNbi% diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index b22588f21..90e25d871 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -12,6 +12,19 @@ generateArtifacts() { "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% }) -%> + <% chaincodes.forEach((chaincode) => { + if (chaincode.lang === "ccaas" && global.tls === true) { + chaincode.channel.orgs.forEach((org) => { + org.peers.forEach((peer) => { %> + printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= peer.address %>" "U1F511" + certsGenerateCCaaS <% -%> + "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> + "<%= chaincode.name %>_<%= peer.address %>" <% -%> + "<%= org.domain %>" <% -%> + "<%= chaincode.name %>" <% -%> + "<%= peer.address %>" + <% }); }); } }); %> + <%_ ordererGroups.forEach((ordererGroup) => { _%> <% if(!global.capabilities.isV3) {%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 83cd43ce5..a0926d7b0 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -10,7 +10,7 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" <% if (chaincode.lang === "ccaas") { -%> <% chaincode.peerChaincodeInstances.forEach((instance) => { -%> - chaincodePackageCaas <% -%> + chaincodePackageCCaaS <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= instance.peerAddress %>" <% -%> "<%= chaincode.name %>" <% -%> @@ -56,7 +56,9 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%- chaincode.endorsement || '' %>" <% -%> "<%= `${chaincode.initRequired}` %>" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>'" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index d4524e82b..30118ce6d 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -377,11 +377,14 @@ services: <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> <%= instance.containerName %>: container_name: <%= instance.containerName %> + hostname: <%= instance.containerName %> image: <%= chaincode.image %> pull_policy: always environment: - - CHAINCODE_SERVER_ADDRESS=0.0.0.0:<%= instance.port %> - - CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + - CORE_CHAINCODE_ADDRESS=0.0.0.0:<%= instance.port %> + - CORE_CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> + volumes: + - ../fabric-config/crypto-config/ccaas/<%= instance.containerName %>/tls:/etc/hyperledger/fabric ports: - <%= instance.port %>:7052 networks: diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index fc2f02f67..36e94761a 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -38,6 +38,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="${CONFIG_PATH}ccaas/${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/tlsca.${ORG_DOMAIN}-cert.pem" + local CA_KEY="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for ${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \ + -v "$OUTPUT_PATH:/certs" \ + -v "$CA_CERT:/ca/ca.crt:ro" \ + -v "$CA_KEY:/ca/ca.key:ro" \ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index 6f7a094cb..5585aecc7 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -38,6 +38,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="${CONFIG_PATH}ccaas/${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/tlsca.${ORG_DOMAIN}-cert.pem" + local CA_KEY="${CONFIG_PATH}peerOrganizations/${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for ${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \ + -v "$OUTPUT_PATH:/certs" \ + -v "$CA_CERT:/ca/ca.crt:ro" \ + -v "$CA_KEY:/ca/ca.key:ro" \ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 1900939a1..786cb1029 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -104,7 +104,7 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCaas() { +chaincodePackageCCaaS() { local CLI_NAME=$1 local PEER_ADDRESS=$2 local CHAINCODE_NAME=$3 @@ -133,8 +133,33 @@ chaincodePackageCaas() { echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" - echo "{\"address\":\"${PEER_ADDRESS}_${CHAINCODE_NAME}:${CONTAINER_PORT}\",\"dial_timeout\":\"10s\",\"tls_required\":$TLS_ENABLED}" > "$PACKAGE_DIR/code/connection.json" + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\n", $0}') + + cat < "$PACKAGE_DIR/code/connection.json" +{ + "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", + "domain": "${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat < "$PACKAGE_DIR/code/connection.json" +{ + "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz @@ -169,6 +194,54 @@ chaincodeInstall() { "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" } +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="${CHAINCODE_NAME}_${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + + docker rm -f "$CONTAINER_NAME" > /dev/null 2>&1 || true + + docker run -d \ + --name "$CONTAINER_NAME" \ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \ + -e DEBUG=true \ + -e CORE_CHAINCODE_ID_NAME="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ + -e CHAINCODE_ID="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \ + -e CORE_CHAINCODE_LOGGING_SHIM=info \ + -e CORE_PEER_TLS_ENABLED=true \ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ + -p "$PORT_MAP" \ + --network "$NETWORK" \ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -181,6 +254,7 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=${10} + local CHAINCODE_LANG=${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -193,6 +267,7 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -227,6 +302,10 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/src/validate/index.ts b/src/validate/index.ts index 08b4d901e..41dc01eb7 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -91,6 +91,7 @@ class ValidateGenerator extends Generator { const networkConfig = parseFabloConfig(this.fs.read(this.options.fabloConfigPath)); this._validateFabricVersion(networkConfig.global); + networkConfig.chaincodes.forEach((chaincode) => this._validateCcaaTLS(networkConfig.global, chaincode)); this._validateJsonSchema(networkConfig); this._validateSupportedFabloVersion(networkConfig.$schema); this._validateOrgs(networkConfig.orgs); @@ -134,6 +135,16 @@ class ValidateGenerator extends Generator { } } + private _validateCcaaTLS(global: GlobalJson, chaincode: ChaincodeJson) { + if (chaincode.lang === "ccaas" && global.tls) { + const objectToEmit = { + category: validationCategories.CRITICAL, + message: `Chaincode '${chaincode.name}' is using CCAAS, but TLS is enabled in the network. CCAAS does not support TLS yet.`, + }; + this.emit(validationErrorType.CRITICAL, objectToEmit); + } + } + async shortSummary() { console.log(`Validation errors count: ${this.errors.count()}`); console.log(`Validation warnings count: ${this.warnings.count()}`); From fd609c2bc1383413dc7f4935f745a4cea9647067 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 20 Jun 2025 17:56:15 -0500 Subject: [PATCH 432/471] Implement CCAAS TLS issue preparation and metadata updates Signed-off-by: Pereowei Daniel --- ...1chaincode-raft-explorer.json.test.ts.snap | 3474 ++++++++++++++++- 1 file changed, 3473 insertions(+), 1 deletion(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b79c8f74e..cda0d0c5b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3 +1,3475 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V2_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 1 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + Consortiums: + SampleConsortium: + Organizations: + - *Orderer + - *Org1 + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *ApplicationCapabilities + Consortium: SampleConsortium + Consortiums: + SampleConsortium: + Organizations: + - *Org1 + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 1 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Hyperledger Explorer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1", + "tlsEnable": true, + "enableAuthentication": true, + "adminCredential": { + "id": "admin", + "password": "adminpw" + }, + "connection": { + "timeout": { + "peer": { + "endorser": "300" + }, + "orderer": "300" + } + } + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "adminPrivateKey": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" + }, + "peers": [ + "peer0.org1.example.com" + ], + "signedCert": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" + } + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://peer0.org1.example.com:7041", + "tlsCACerts": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" + } + } + }, + "channels": { + "my-channel1": { + "peers": {} + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"FABLO_VERSION=2.2.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=info + +FABRIC_VERSION=2.5.12 +FABRIC_TOOLS_VERSION=2.5.12 +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=2.5.12 +FABRIC_BASEOS_VERSION=2.5.12 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + fi + + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating genesis block for group group1" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +runDevModeChaincode() { + local chaincodeName=$1 + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + local version="0.0.1" + printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + + fi +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" + chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + fi + fi +} + +notifyOrgsAboutChannels() { + + printHeadline "Creating new channel config blocks" "U1F537" + createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" + + printHeadline "Notyfing orgs about channels" "U1F4E2" + notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + printHeadline "Deleting new channel config blocks" "U1F52A" + deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_DB_TLS_ENABLED=false + - FABRIC_CA_SERVER_DB_TYPE=postgres + - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + depends_on: + db.ca.org1.example.com: + condition: service_healthy + networks: + - basic + + db.ca.org1.example.com: + container_name: db.ca.org1.example.com + image: postgres:\${FABRIC_CA_POSTGRES_VERSION} + environment: + - POSTGRES_PASSWORD=caDbPass12345 + - POSTGRES_USER=postgres + - POSTGRES_DB=fabriccaserver + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + fablo-rest.org1.example.com: + container_name: fablo-rest.org1.example.com + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} + environment: + - PORT=8000 + - MSP_ID=Org1MSP + - FABRIC_CA_URL=https://ca.org1.example.com:7054 + - FABRIC_CA_NAME=ca.org1.example.com + - AS_LOCALHOST=false + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - HFC_LOGGING={"error":"console","warn":"console","info":"console"} + volumes: + # note: fablo needs access to all anchor peer certs + - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro + ports: + - 8801:8000 + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # CouchDB + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + depends_on: + couchdb.peer0.org1.example.com: + condition: service_healthy + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + couchdb.peer0.org1.example.com: + container_name: couchdb.peer0.org1.example.com + image: couchdb:\${COUCHDB_VERSION} + environment: + - COUCHDB_USER=peer0 + - COUCHDB_PASSWORD=peer0Password + healthcheck: + test: "curl -f http://localhost:5984/" + interval: 5s + timeout: 10s + retries: 7 + ports: + - 5100:5984 + networks: + - basic + + db.explorer.example.com: + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + container_name: db.explorer.example.com + environment: + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWORD=password + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + explorer.example.com: + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + restart: on-failure:8 + container_name: explorer.example.com + environment: + - DATABASE_HOST=db.explorer.example.com + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWD=password + - LOG_LEVEL_APP=debug + - LOG_LEVEL_DB=debug + - LOG_LEVEL_CONSOLE=info + - LOG_CONSOLE_STDOUT=true + - DISCOVERY_AS_LOCALHOST=false + volumes: + - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json + - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile + - ../fabric-config/crypto-config:/tmp/crypto + ports: + - "7010:8080" + depends_on: + db.explorer.example.com: + condition: service_healthy + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version + +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + local CHAINCODE_IMAGE=$6 + local CONTAINER_PORT=$7 + local CONTAINER_NAME=$8 + local TLS_ENABLED=$9 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + echo "Packaging chaincode as CCAAS (external builder)..." + + local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') + + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "domain": "\${CONTAINER_NAME}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, + "client_auth_required": true, + "client_cert": "$SERVER_CERT", + "client_key": "$SERVER_KEY", + "root_cert": "$ROOT_CERT" +} +EOF + else + cat <"$PACKAGE_DIR/code/connection.json" +{ + "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", + "dial_timeout": "10s", + "tls_required": $TLS_ENABLED, +} +EOF + fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +restartChaincodeContainerWithCorrectId() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CC_PACKAGE_ID="$4" + local CHAINCODE_IMAGE="$5" + + local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" + local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" + + echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local PORT_MAP="7052:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ + -e DEBUG=true \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ + -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ + -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ + -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ + -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ + -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + local CHAINCODE_LANG=\${11} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + if [ "$CHAINCODE_LANG" = "ccaas" ]; then + local CHAINCODE_IMAGE=\${12} + restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx + peer channel join -b "\${CHANNEL_NAME}".block + + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + peer0.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + " +} + +__getCAPostgresNodes() { + echo " + db.ca.org1.example.com + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" + +perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", +] +`; From af89893cd2d245010792cdbbf03ce355d3bf88eb Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 08:49:17 +0200 Subject: [PATCH 433/471] Checkpoint Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-01-simple.sh | 20 +-- src/extend-config/extendChaincodesConfig.ts | 51 +++---- src/init/index.ts | 125 +++++++++--------- .../fabric-docker/commands-generated.sh | 15 +-- .../chaincode-install-v2.sh | 28 ++-- .../fabric-docker/docker-compose.yaml | 18 --- .../scripts/chaincode-functions-v2.sh | 48 +++++-- src/validate/index.ts | 10 +- 8 files changed, 164 insertions(+), 151 deletions(-) diff --git a/e2e-network/docker/test-01-simple.sh b/e2e-network/docker/test-01-simple.sh index 2538e93cf..5c4b33eaa 100755 --- a/e2e-network/docker/test-01-simple.sh +++ b/e2e-network/docker/test-01-simple.sh @@ -2,7 +2,7 @@ set -e -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_TMP="$(rm -rf "$0.tmpdir2" && mkdir -p "$0.tmpdir2" && (cd "$0.tmpdir2" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." @@ -49,22 +49,22 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT networkUp waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" -waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +# waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" +# waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +# waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +# waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" # Test simple chaincode expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' +# expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ +# '{"Args":["KVContract:get", "name"]}' \ +# '{\"success\":\"Willy Wonka\"}' # Verify channel query scripts (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) @@ -81,7 +81,7 @@ expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my- # Reset and ensure the state is lost after reset (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +# waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:get", "name"]}' \ '{\"error\":\"NOT_FOUND\"}' diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index 1861dfec6..4d55c70a5 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -58,36 +58,39 @@ const extendChaincodesConfig = ( ); const privateDataConfigFile = privateData.length > 0 ? `collections/${chaincode.name}.json` : undefined; - const peerChaincodeInstances = !chaincode.image ? [] : channel.orgs.flatMap((org) => - org.peers.map((peer) => { - return { - containerName: `${chaincode.name}_${peer.address}`, - peerAddress: peer.address, - port: portCounter++, - orgDomain: org.domain - }; - }) - ); + const peerChaincodeInstances = !chaincode.image + ? [] + : channel.orgs.flatMap((org) => + org.peers.map((peer) => { + return { + // the beginning of the name matches the convention used by regular local Fabric chaincode containers + containerName: `ccaas-${peer.address}-${chaincode.name}`, + peerAddress: peer.address, + port: portCounter++, + orgDomain: org.domain, + }; + }), + ); if (chaincode.lang === "ccaas") { if (!chaincode.image) { throw new Error(`Chaincode '${chaincode.name}' of type 'ccaas' must specify an image field`); } } - return { - directory: chaincode.directory, - name: chaincode.name, - version: chaincode.version, - lang: chaincode.lang, - channel, - image: chaincode.image, - ...initParams, - endorsement, - instantiatingOrg: channel.instantiatingOrg, - privateDataConfigFile, - peerChaincodeInstances, - privateData, - }; + return { + directory: chaincode.directory, + name: chaincode.name, + version: chaincode.version, + lang: chaincode.lang, + channel, + image: chaincode.image, + ...initParams, + endorsement, + instantiatingOrg: channel.instantiatingOrg, + privateDataConfigFile, + peerChaincodeInstances, + privateData, + }; }); }; diff --git a/src/init/index.ts b/src/init/index.ts index 52d90bd11..163ded860 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -1,76 +1,77 @@ import * as Generator from "yeoman-generator"; import * as chalk from "chalk"; import { GlobalJson, FabloConfigJson } from "../types/FabloConfigJson"; +import { version } from "../../package.json"; function getDefaultFabloConfig(): FabloConfigJson { return { - $schema: "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", - global: { - fabricVersion: "2.5.9", - tls: false, - peerDevMode: false, - }, - orgs: [ - { - organization: { - name: "Orderer", - domain: "orderer.example.com", - mspName: "OrdererMSP", - }, - ca: { - prefix: "ca", - db: "sqlite", + $schema: `https://github.com/hyperledger-labs/fablo/releases/download/${version}/schema.json`, + global: { + fabricVersion: "2.5.12", + tls: true, + peerDevMode: false, + }, + orgs: [ + { + organization: { + name: "Orderer", + domain: "orderer.example.com", + mspName: "OrdererMSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [ + { + groupName: "group1", + type: "raft", + instances: 1, + prefix: "orderer", + }, + ], }, - orderers: [ - { - groupName: "group1", - type: "solo", + { + organization: { + name: "Org1", + domain: "org1.example.com", + mspName: "Org1MSP", + }, + ca: { + prefix: "ca", + db: "sqlite", + }, + orderers: [], + peer: { instances: 1, - prefix: "orderer", + db: "LevelDb", + prefix: "peer", }, - ], - }, - { - organization: { - name: "Org1", - domain: "org1.example.com", - mspName: "Org1MSP", }, - ca: { - prefix: "ca", - db: "sqlite", + ], + channels: [ + { + name: "my-channel1", + orgs: [ + { + name: "Org1", + peers: ["peer0", "peer1"], + }, + ], }, - orderers: [], - peer: { - instances: 2, - db: "LevelDb", - prefix: "peer", + ], + chaincodes: [ + { + name: "chaincode1", + version: "0.0.1", + lang: "ccaas", + channel: "my-channel1", + image: "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + privateData: [], }, - }, - ], - channels: [ - { - name: "my-channel1", - orgs: [ - { - name: "Org1", - peers: ["peer0", "peer1"], - }, - ], - }, - ], - chaincodes: [ - { - name: "chaincode1", - version: "0.0.1", - lang: "node", - channel: "my-channel1", - directory: "./chaincodes/chaincode-kv-node", - privateData: [], - }, - ], - hooks: {}, - }; + ], + hooks: {}, + }; } export default class InitGenerator extends Generator { @@ -118,4 +119,4 @@ export default class InitGenerator extends Generator { console.log("==========================================================="); }); } -} \ No newline at end of file +} diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 90e25d871..93112509b 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -14,16 +14,15 @@ generateArtifacts() { <% }) -%> <% chaincodes.forEach((chaincode) => { if (chaincode.lang === "ccaas" && global.tls === true) { - chaincode.channel.orgs.forEach((org) => { - org.peers.forEach((peer) => { %> - printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= peer.address %>" "U1F511" + chaincode.peerChaincodeInstances.forEach((instance) => { %> + printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= instance.peerAddress %>" "U1F511" certsGenerateCCaaS <% -%> "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> - "<%= chaincode.name %>_<%= peer.address %>" <% -%> - "<%= org.domain %>" <% -%> + "<%= instance.containerName %>" <% -%> + "<%= instance.orgDomain %>" <% -%> "<%= chaincode.name %>" <% -%> - "<%= peer.address %>" - <% }); }); } }); %> + "<%= instance.peerAddress %>" + <% }); } }); %> <%_ ordererGroups.forEach((ordererGroup) => { _%> @@ -266,7 +265,7 @@ networkDown() { <% chaincodes.forEach((chaincode) => { -%> <% chaincode.channel.orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - <% const chaincodeContainerName=`dev-${peer.address}-${chaincode.name}` -%> + <% const chaincodeContainerName=`ccaas-${peer.address}-${chaincode.name}` -%> for container in $(docker ps -a | grep "<%= chaincodeContainerName %>" | awk '{print $1}'); do echo "Removing container $container..."; docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted"; done for image in $(docker images "<%= chaincodeContainerName %>*" -q); do echo "Removing image $image..."; docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted"; done <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index a0926d7b0..542c7a7bf 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -46,19 +46,21 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "$version" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% }) -%> - chaincodeApprove <% -%> - "<%= org.cli.address %>" <% -%> - "<%= org.headPeer.fullAddress %>" <% -%> - "<%= chaincode.channel.name %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> - "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" + <% org.peers.forEach((peer) => { -%> + chaincodeApprove <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.channel.name %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> + "<%- chaincode.endorsement || '' %>" <% -%> + "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" + <% }) -%> <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>'" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 30118ce6d..df5e3489f 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -373,21 +373,3 @@ services: networks: - basic <%_ } _%> -<% chaincodes.forEach(function(chaincode) { if (chaincode.lang === 'ccaas' || chaincode.image) { %> - <% chaincode.peerChaincodeInstances.forEach(function(instance) { %> - <%= instance.containerName %>: - container_name: <%= instance.containerName %> - hostname: <%= instance.containerName %> - image: <%= chaincode.image %> - pull_policy: always - environment: - - CORE_CHAINCODE_ADDRESS=0.0.0.0:<%= instance.port %> - - CORE_CHAINCODE_ID=<%= chaincode.name %>:<%= chaincode.version %> - volumes: - - ../fabric-config/crypto-config/ccaas/<%= instance.containerName %>/tls:/etc/hyperledger/fabric - ports: - - <%= instance.port %>:7052 - networks: - - basic - <% }) %> -<% } }) %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 786cb1029..ed41f848d 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -135,9 +135,10 @@ chaincodePackageCCaaS() { mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\n", $0}') + local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + local ROOT_CERT=$(cat "$TLS_PATH/peer.crt" | awk '{printf "%s\\n", $0}') + local SERVER_CERT=$(cat "$TLS_PATH/client.crt" | awk '{printf "%s\\n", $0}') + local SERVER_KEY=$(cat "$TLS_PATH/client.key" | awk '{printf "%s\\n", $0}') cat < "$PACKAGE_DIR/code/connection.json" { @@ -188,6 +189,8 @@ chaincodeInstall() { if [ -n "$CA_CERT" ]; then CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") fi + + set -x docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ @@ -202,15 +205,37 @@ restartChaincodeContainerWithCorrectId() { local CHAINCODE_IMAGE="$5" local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="${CHAINCODE_NAME}_${PEER_ADDRESS%%:*}" + local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" local PORT_MAP="7052:7052" + # Use different ports for different containers to avoid conflicts + if [[ "$CONTAINER_NAME" == *"peer1"* ]]; then + PORT_MAP="7053:7052" + fi + local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + # Verify all required TLS files exist + local REQUIRED_TLS_FILES=( + "$TLS_PATH/client.key" + "$TLS_PATH/client.crt" + "$TLS_PATH/client_pem.key" + "$TLS_PATH/client_pem.crt" + "$TLS_PATH/peer.crt" + ) + + echo "Verifying TLS files exist..." + for file in "${REQUIRED_TLS_FILES[@]}"; do + if [ ! -f "$file" ]; then + echo "ERROR: Required TLS file missing: $file" + exit 1 + fi + echo "✓ Found: $file" + done docker rm -f "$CONTAINER_NAME" > /dev/null 2>&1 || true @@ -218,20 +243,15 @@ restartChaincodeContainerWithCorrectId() { --name "$CONTAINER_NAME" \ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \ - -e DEBUG=true \ -e CORE_CHAINCODE_ID_NAME="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CHAINCODE_ID="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CORE_CHAINCODE_LOGGING_LEVEL=info \ -e CORE_CHAINCODE_LOGGING_SHIM=info \ -e CORE_PEER_TLS_ENABLED=true \ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ - -e CORE_PEER_LOCALMSPID=Org1MSP \ -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \ -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ + -e CORE_PEER_LOCALMSPID=Org1MSP \ -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \ @@ -240,6 +260,10 @@ restartChaincodeContainerWithCorrectId() { -p "$PORT_MAP" \ --network "$NETWORK" \ "$CHAINCODE_IMAGE" + + # Redirect container logs to the log file in the background + echo "Redirecting container logs to $(pwd)/$CONTAINER_NAME.log" + docker logs -f "$CONTAINER_NAME" > "./$CONTAINER_NAME.log" 2>&1 & } chaincodeApprove() { @@ -297,8 +321,10 @@ chaincodeApprove() { --output json \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" )" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/src/validate/index.ts b/src/validate/index.ts index 41dc01eb7..184f03010 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -137,11 +137,11 @@ class ValidateGenerator extends Generator { private _validateCcaaTLS(global: GlobalJson, chaincode: ChaincodeJson) { if (chaincode.lang === "ccaas" && global.tls) { - const objectToEmit = { - category: validationCategories.CRITICAL, - message: `Chaincode '${chaincode.name}' is using CCAAS, but TLS is enabled in the network. CCAAS does not support TLS yet.`, - }; - this.emit(validationErrorType.CRITICAL, objectToEmit); + // const objectToEmit = { + // category: validationCategories.CRITICAL, + // message: `Chaincode '${chaincode.name}' is using CCAAS, but TLS is enabled in the network. CCAAS does not support TLS yet.`, + // }; + // TODO this.emit(validationErrorType.CRITICAL, objectToEmit); } } From 8f7982ffd3f2ea334e024f8d30addc2613492d4b Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 12:26:19 +0200 Subject: [PATCH 434/471] PoC of CCaaS Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .../chaincodes/chaincode-kv-node/package.json | 2 +- .../fabric-docker/commands-generated.sh | 20 +---- .../scripts/base-functions-v2.sh | 26 +++++- .../scripts/chaincode-functions-v2.sh | 85 ++++++++++++++----- 4 files changed, 95 insertions(+), 38 deletions(-) diff --git a/samples/chaincodes/chaincode-kv-node/package.json b/samples/chaincodes/chaincode-kv-node/package.json index 4751eb2e3..f50ae9b09 100644 --- a/samples/chaincodes/chaincode-kv-node/package.json +++ b/samples/chaincodes/chaincode-kv-node/package.json @@ -8,7 +8,7 @@ }, "scripts": { "start": "fabric-chaincode-node start", - "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"chaincode1:0.0.1\"", + "start:ccaas": "fabric-chaincode-node server --chaincode-address 0.0.0.0:7052 --chaincode-id \"$CHAINCODE_ID\"", "start:dev": "fabric-chaincode-node start --peer.address \"127.0.0.1:8541\" --chaincode-id-name \"chaincode1:0.0.1\" --tls.enabled false", "start:watch": "nodemon --exec \"npm run start:dev\"", "build": "echo \"No need to build the chaincode\"", diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 93112509b..8c71fb984 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -12,18 +12,6 @@ generateArtifacts() { "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% }) -%> - <% chaincodes.forEach((chaincode) => { - if (chaincode.lang === "ccaas" && global.tls === true) { - chaincode.peerChaincodeInstances.forEach((instance) => { %> - printItalics "Generating certs for CCaaS '<%= chaincode.name %>' on <%= instance.peerAddress %>" "U1F511" - certsGenerateCCaaS <% -%> - "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" <% -%> - "<%= instance.containerName %>" <% -%> - "<%= instance.orgDomain %>" <% -%> - "<%= chaincode.name %>" <% -%> - "<%= instance.peerAddress %>" - <% }); } }); %> - <%_ ordererGroups.forEach((ordererGroup) => { _%> <% if(!global.capabilities.isV3) {%> @@ -258,20 +246,20 @@ stopNetwork() { } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \U1F5D1 \n" <% chaincodes.forEach((chaincode) => { -%> <% chaincode.channel.orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - <% const chaincodeContainerName=`ccaas-${peer.address}-${chaincode.name}` -%> + <% const chaincodeContainerName=`ccaas-` -%> for container in $(docker ps -a | grep "<%= chaincodeContainerName %>" | awk '{print $1}'); do echo "Removing container $container..."; docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted"; done for image in $(docker images "<%= chaincodeContainerName %>*" -q); do echo "Removing image $image..."; docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted"; done <% }) -%> <% }) -%> <% }) -%> + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \U1F5D1 \n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 36e94761a..966e52363 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -68,9 +68,31 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && base64 /certs/client.key > /certs/client_pem.key ' diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index ed41f848d..5212bd1bb 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -135,10 +135,11 @@ chaincodePackageCCaaS() { mkdir -p "$PACKAGE_DIR/code" if [ "$TLS_ENABLED" = true ]; then - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local ROOT_CERT=$(cat "$TLS_PATH/peer.crt" | awk '{printf "%s\\n", $0}') - local SERVER_CERT=$(cat "$TLS_PATH/client.crt" | awk '{printf "%s\\n", $0}') - local SERVER_KEY=$(cat "$TLS_PATH/client.key" | awk '{printf "%s\\n", $0}') + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\n", $0}') cat < "$PACKAGE_DIR/code/connection.json" { @@ -209,7 +210,10 @@ restartChaincodeContainerWithCorrectId() { echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" + # Extract peer name and organization domain from peer address + local PEER_NAME="${PEER_ADDRESS%%:*}" + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" local PORT_MAP="7052:7052" # Use different ports for different containers to avoid conflicts @@ -219,19 +223,24 @@ restartChaincodeContainerWithCorrectId() { local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - # Verify all required TLS files exist + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + # Verify CCAAS TLS files exist local REQUIRED_TLS_FILES=( - "$TLS_PATH/client.key" - "$TLS_PATH/client.crt" - "$TLS_PATH/client_pem.key" - "$TLS_PATH/client_pem.crt" - "$TLS_PATH/peer.crt" + "$CCAAS_TLS_PATH/client.key" + "$CCAAS_TLS_PATH/client.crt" + "$CCAAS_TLS_PATH/peer.crt" ) - echo "Verifying TLS files exist..." + echo "Verifying CCAAS TLS files exist for $CONTAINER_NAME..." for file in "${REQUIRED_TLS_FILES[@]}"; do if [ ! -f "$file" ]; then - echo "ERROR: Required TLS file missing: $file" + echo "ERROR: Required CCAAS TLS file missing: $file" exit 1 fi echo "✓ Found: $file" @@ -242,7 +251,7 @@ restartChaincodeContainerWithCorrectId() { docker run -d \ --name "$CONTAINER_NAME" \ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \ -e CORE_CHAINCODE_ID_NAME="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CHAINCODE_ID="${CHAINCODE_LABEL}:${PACKAGE_HASH}" \ -e CORE_CHAINCODE_LOGGING_LEVEL=info \ @@ -252,11 +261,9 @@ restartChaincodeContainerWithCorrectId() { -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \ -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \ -e CORE_PEER_LOCALMSPID=Org1MSP \ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \ -p "$PORT_MAP" \ --network "$NETWORK" \ "$CHAINCODE_IMAGE" @@ -264,6 +271,46 @@ restartChaincodeContainerWithCorrectId() { # Redirect container logs to the log file in the background echo "Redirecting container logs to $(pwd)/$CONTAINER_NAME.log" docker logs -f "$CONTAINER_NAME" > "./$CONTAINER_NAME.log" 2>&1 & + + # Wait for the container to be ready + echo "Waiting for CCaaS container to be ready..." + local MAX_ATTEMPTS=30 + local ATTEMPT=1 + + # Give the container a moment to start + sleep 3 + + while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do + # First check if container is running + if ! docker ps --format "{{.Names}}" | grep -q "^$CONTAINER_NAME$"; then + echo "❌ Container $CONTAINER_NAME is not running" + docker logs "$CONTAINER_NAME" + exit 1 + fi + + # Check if the container is listening on port 7052 + if docker exec "$CONTAINER_NAME" sh -c "netstat -tlnp 2>/dev/null | grep :7052" > /dev/null 2>&1; then + echo "✅ CCaaS container is ready on port 7052" + break + fi + + # Alternative check: try to connect to the port from outside + if timeout 2 bash -c " /dev/null 2>&1; then + echo "✅ CCaaS container is ready on port 7052 (external check)" + break + fi + + if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then + echo "❌ Timeout waiting for CCaaS container to be ready" + echo "Container logs:" + docker logs "$CONTAINER_NAME" + exit 1 + fi + + echo "⏳ Waiting for CCaaS container to be ready... (attempt $ATTEMPT/$MAX_ATTEMPTS)" + sleep 2 + ATTEMPT=$((ATTEMPT + 1)) + done } chaincodeApprove() { From 38e8be2a1a4134eaea915165d338c9cc9c39f2a3 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 13:26:30 +0200 Subject: [PATCH 435/471] PoC (checkpoint working) Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- src/init/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init/index.ts b/src/init/index.ts index 163ded860..ca0e9135c 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -55,7 +55,7 @@ function getDefaultFabloConfig(): FabloConfigJson { orgs: [ { name: "Org1", - peers: ["peer0", "peer1"], + peers: ["peer0"], }, ], }, From 94b7c9893e393d56b2841712b3453210b3ad1278 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 14:31:42 +0200 Subject: [PATCH 436/471] Rafactor and use proper ports Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- src/extend-config/extendChaincodesConfig.ts | 6 +- .../commands-generated/chaincode-dev-v2.sh | 4 +- .../chaincode-install-v2.sh | 37 ++-- .../scripts/chaincode-functions-v2.sh | 205 +++++++++--------- 4 files changed, 130 insertions(+), 122 deletions(-) diff --git a/src/extend-config/extendChaincodesConfig.ts b/src/extend-config/extendChaincodesConfig.ts index 4d55c70a5..a70b00b53 100644 --- a/src/extend-config/extendChaincodesConfig.ts +++ b/src/extend-config/extendChaincodesConfig.ts @@ -42,8 +42,7 @@ const extendChaincodesConfig = ( transformedChannels: ChannelConfig[], network: Global, ): ChaincodeConfig[] => { - let portCounter = 7052; - return chaincodes.map((chaincode) => { + return chaincodes.map((chaincode, index) => { const channel = transformedChannels.find((c) => c.name === chaincode.channel); if (!channel) throw new Error(`No matching channel with name '${chaincode.channel}'`); @@ -63,10 +62,9 @@ const extendChaincodesConfig = ( : channel.orgs.flatMap((org) => org.peers.map((peer) => { return { - // the beginning of the name matches the convention used by regular local Fabric chaincode containers containerName: `ccaas-${peer.address}-${chaincode.name}`, peerAddress: peer.address, - port: portCounter++, + port: 10000 * (index + 1) + peer.port, orgDomain: org.domain, }; }), diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh index f165969fd..130691b26 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-dev-v2.sh @@ -16,7 +16,9 @@ "<%- chaincode.endorsement || '' %>" <% -%> "false" <% -%> "" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "" <% -%> + "" <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>' (dev mode)" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 542c7a7bf..a31f7116a 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -22,13 +22,11 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= global.tls %>" <% }) -%> <% } else { -%> - <% if (!chaincode.image) { -%> - chaincodeBuild <% -%> - "<%= chaincode.name %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> - "<%= global.fabricRecommendedNodeVersion %>" - <% } -%> + chaincodeBuild <% -%> + "<%= chaincode.name %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "$CHAINCODES_BASE_DIR/<%= chaincode.directory %>" <% -%> + "<%= global.fabricRecommendedNodeVersion %>" chaincodePackage <% -%> "<%= chaincode.instantiatingOrg.cli.address %>" <% -%> "<%= chaincode.instantiatingOrg.headPeer.fullAddress %>" <% -%> @@ -38,13 +36,24 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" <% } -%> <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" - <% org.peers.forEach((peer) => { -%> - chaincodeInstall <% -%> - "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% org.peers.forEach((peer, i) => { -%> + <% if (chaincode.lang === "ccaas") { -%> + chaincodeInstallCCaaS <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.image %>" <% -%> + "<%= chaincode.peerChaincodeInstances[i].port %>" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% } else { -%> + chaincodeInstall <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" + <% } -%> <% }) -%> <% org.peers.forEach((peer) => { -%> chaincodeApprove <% -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 5212bd1bb..1cc87db28 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -9,29 +9,27 @@ dockerPullIfMissing() { fi } -node_version_check(){ - - local fabric_shim_version="$1" - local nodejs_version +node_version_check() { + local fabric_shim_version="$1" + local nodejs_version - if [[ "$fabric_shim_version" == *"1.4."* ]]; then - nodejs_version=8.9 + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 - elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then - nodejs_version=12.13 + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 - elif [[ "$fabric_shim_version" == *"2.4."* ]]; then - nodejs_version=16.16 + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 - elif [[ "$fabric_shim_version" == *"2.5."* ]]; then - nodejs_version=18.12 + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 - else - nodejs_version=18.12 - fi - - echo $nodejs_version + else + nodejs_version=18.12 + fi + echo $nodejs_version } chaincodeBuild() { @@ -73,10 +71,9 @@ chaincodeBuild() { inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" - + # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -116,7 +113,7 @@ chaincodePackageCCaaS() { local CONTAINER_NAME=$8 local TLS_ENABLED=$9 - echo "Packaging chaincode $CHAINCODE_NAME..." + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" @@ -124,13 +121,13 @@ chaincodePackageCCaaS() { inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" inputLog "CONTAINER_PORT: $CONTAINER_PORT" inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + mkdir -p "$PACKAGE_DIR" - echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" > "$PACKAGE_DIR/metadata.json" + echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" @@ -141,34 +138,31 @@ chaincodePackageCCaaS() { local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\n", $0}') local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\n", $0}') - cat < "$PACKAGE_DIR/code/connection.json" -{ - "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", - "domain": "${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF + echo "{ + \"address\": \"${ACTUAL_CONTAINER_NAME}:7052\", + \"domain\": \"${ACTUAL_CONTAINER_NAME}\", + \"dial_timeout\": \"10s\", + \"tls_required\": $TLS_ENABLED, + \"client_auth_required\": true, + \"client_cert\": \"$SERVER_CERT\", + \"client_key\": \"$SERVER_KEY\", + \"root_cert\": \"$ROOT_CERT\" + }" >"$PACKAGE_DIR/code/connection.json" else - cat < "$PACKAGE_DIR/code/connection.json" -{ - "address": "${CONTAINER_NAME}:${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF + echo "{ + \"address\": \"${ACTUAL_CONTAINER_NAME}:7052\", + \"dial_timeout\": \"10s\", + \"tls_required\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" fi + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz"; + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" + rm -rf "$PACKAGE_DIR" echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } @@ -190,37 +184,90 @@ chaincodeInstall() { if [ -n "$CA_CERT" ]; then CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") fi - - set -x docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \ "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { +chaincodeInstallCCaaS() { + set -x + + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local EXTERNAL_PORT=$6 + local CA_CERT=$7 + + local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" + + # Install the chaincode + INSTALL_RESPONSE="$(chaincodeInstall "$CLI_NAME" "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_VERSION" "$CA_CERT")" + echo "INSTALL_RESPONSE: $INSTALL_RESPONSE" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \ + --output json \ + "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" + )" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + startCCaaSContainer "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$PACKAGE_ID" "$CHAINCODE_IMAGE" "$EXTERNAL_PORT" +} + +startCCaaSContainer() { local PEER_ADDRESS="$1" local CHAINCODE_NAME="$2" local CHAINCODE_LABEL="$3" local CC_PACKAGE_ID="$4" local CHAINCODE_IMAGE="$5" + local EXTERNAL_PORT="$6" local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" + # If PACKAGE_HASH is empty, use the full CC_PACKAGE_ID + if [ -z "$PACKAGE_HASH" ]; then + PACKAGE_HASH="$CC_PACKAGE_ID" + fi + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" # Extract peer name and organization domain from peer address local PEER_NAME="${PEER_ADDRESS%%:*}" local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\.//') local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - local PORT_MAP="7052:7052" - + # The connection.json expects the container to be accessible on CONTAINER_PORT (17041) + # The container internally listens on 7052, so we map EXTERNAL_PORT:7052 + # This allows the peer to connect to EXTERNAL_PORT and reach the container's 7052 port + local PORT_MAP="${EXTERNAL_PORT}:7052" + # Use different ports for different containers to avoid conflicts if [[ "$CONTAINER_NAME" == *"peer1"* ]]; then PORT_MAP="7053:7052" fi - + local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') # Generate CCAAS-specific certificates with correct CN @@ -246,7 +293,7 @@ restartChaincodeContainerWithCorrectId() { echo "✓ Found: $file" done - docker rm -f "$CONTAINER_NAME" > /dev/null 2>&1 || true + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true docker run -d \ --name "$CONTAINER_NAME" \ @@ -267,50 +314,6 @@ restartChaincodeContainerWithCorrectId() { -p "$PORT_MAP" \ --network "$NETWORK" \ "$CHAINCODE_IMAGE" - - # Redirect container logs to the log file in the background - echo "Redirecting container logs to $(pwd)/$CONTAINER_NAME.log" - docker logs -f "$CONTAINER_NAME" > "./$CONTAINER_NAME.log" 2>&1 & - - # Wait for the container to be ready - echo "Waiting for CCaaS container to be ready..." - local MAX_ATTEMPTS=30 - local ATTEMPT=1 - - # Give the container a moment to start - sleep 3 - - while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do - # First check if container is running - if ! docker ps --format "{{.Names}}" | grep -q "^$CONTAINER_NAME$"; then - echo "❌ Container $CONTAINER_NAME is not running" - docker logs "$CONTAINER_NAME" - exit 1 - fi - - # Check if the container is listening on port 7052 - if docker exec "$CONTAINER_NAME" sh -c "netstat -tlnp 2>/dev/null | grep :7052" > /dev/null 2>&1; then - echo "✅ CCaaS container is ready on port 7052" - break - fi - - # Alternative check: try to connect to the port from outside - if timeout 2 bash -c " /dev/null 2>&1; then - echo "✅ CCaaS container is ready on port 7052 (external check)" - break - fi - - if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then - echo "❌ Timeout waiting for CCaaS container to be ready" - echo "Container logs:" - docker logs "$CONTAINER_NAME" - exit 1 - fi - - echo "⏳ Waiting for CCaaS container to be ready... (attempt $ATTEMPT/$MAX_ATTEMPTS)" - sleep 2 - ATTEMPT=$((ATTEMPT + 1)) - done } chaincodeApprove() { @@ -375,10 +378,6 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE From 8762d83f3ea60c5b7282b04bd593e3aaeaba5845 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 14:41:15 +0200 Subject: [PATCH 437/471] Fixes for multiple peers Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- src/init/index.ts | 4 +-- .../chaincode-install-v2.sh | 28 +++++++++---------- .../scripts/chaincode-functions-v2.sh | 5 ---- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/init/index.ts b/src/init/index.ts index ca0e9135c..1055e4b60 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -43,7 +43,7 @@ function getDefaultFabloConfig(): FabloConfigJson { }, orderers: [], peer: { - instances: 1, + instances: 2, db: "LevelDb", prefix: "peer", }, @@ -55,7 +55,7 @@ function getDefaultFabloConfig(): FabloConfigJson { orgs: [ { name: "Org1", - peers: ["peer0"], + peers: ["peer0", "peer1"], }, ], }, diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index a31f7116a..c83c826ac 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -55,21 +55,19 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% } -%> <% }) -%> - <% org.peers.forEach((peer) => { -%> - chaincodeApprove <% -%> - "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.channel.name %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> - "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> - "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> - "<%= chaincode.privateDataConfigFile || '' %>" <% -%> - "<%= chaincode.lang %>" <% -%> - "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" - <% }) -%> + chaincodeApprove <% -%> + "<%= org.cli.address %>" <% -%> + "<%= org.headPeer.fullAddress %>" <% -%> + "<%= chaincode.channel.name %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> + "<%- chaincode.endorsement || '' %>" <% -%> + "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> + "<%= chaincode.privateDataConfigFile || '' %>" <% -%> + "<%= chaincode.lang %>" <% -%> + "<%= chaincode.lang === 'ccaas' ? chaincode.image : '' %>" <% }) -%> printItalics "Committing chaincode '<%= chaincode.name %>' on channel '<%= chaincode.channel.name %>' as '<%= chaincode.instantiatingOrg.name %>'" "U1F618" chaincodeCommit <% -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 1cc87db28..d21aa423b 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -263,11 +263,6 @@ startCCaaSContainer() { # This allows the peer to connect to EXTERNAL_PORT and reach the container's 7052 port local PORT_MAP="${EXTERNAL_PORT}:7052" - # Use different ports for different containers to avoid conflicts - if [[ "$CONTAINER_NAME" == *"peer1"* ]]; then - PORT_MAP="7053:7052" - fi - local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') # Generate CCAAS-specific certificates with correct CN From b13027d2d2d21d65acdc232c66da0c5f63d3b632 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 14:55:07 +0200 Subject: [PATCH 438/471] Refactoring Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-01-simple.sh | 20 +++--- .../chaincode-install-v2.sh | 17 +++-- .../scripts/chaincode-functions-v2.sh | 66 ++++--------------- 3 files changed, 30 insertions(+), 73 deletions(-) diff --git a/e2e-network/docker/test-01-simple.sh b/e2e-network/docker/test-01-simple.sh index 5c4b33eaa..3c21fc023 100755 --- a/e2e-network/docker/test-01-simple.sh +++ b/e2e-network/docker/test-01-simple.sh @@ -2,7 +2,7 @@ set -e -TEST_TMP="$(rm -rf "$0.tmpdir2" && mkdir -p "$0.tmpdir2" && (cd "$0.tmpdir2" && pwd))" +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" FABLO_HOME="$TEST_TMP/../../.." @@ -51,20 +51,20 @@ networkUp waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -# waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -# waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -# waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -# waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" # Test simple chaincode expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ '{\"success\":\"OK\"}' -# expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ -# '{"Args":["KVContract:get", "name"]}' \ -# '{\"success\":\"Willy Wonka\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' # Verify channel query scripts (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) @@ -89,4 +89,6 @@ expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ # Put some data again expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "James Bond"]}' \ - '{\"success\":\"OK\"}' \ No newline at end of file + '{\"success\":\"OK\"}' + +echo "✅ Test passed!" \ No newline at end of file diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index c83c826ac..7330ccaa5 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -37,21 +37,20 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" <% chaincode.channel.orgs.forEach((org) => { -%> printHeadline "Installing '<%= chaincode.name %>' for <%= org.name %>" "U1F60E" <% org.peers.forEach((peer, i) => { -%> + chaincodeInstall <% -%> + "<%= org.cli.address %>" <% -%> + "<%= peer.fullAddress %>" <% -%> + "<%= chaincode.name %>" <% -%> + "$version" <% -%> + "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% if (chaincode.lang === "ccaas") { -%> - chaincodeInstallCCaaS <% -%> - "<%= org.cli.address %>" <% -%> + startCCaaSContainer <% -%> "<%= peer.fullAddress %>" <% -%> "<%= chaincode.name %>" <% -%> - "$version" <% -%> + "<%= chaincode.name %>_$version" <% -%> "<%= chaincode.image %>" <% -%> "<%= chaincode.peerChaincodeInstances[i].port %>" <% -%> - "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" - <% } else { -%> - chaincodeInstall <% -%> "<%= org.cli.address %>" <% -%> - "<%= peer.fullAddress %>" <% -%> - "<%= chaincode.name %>" <% -%> - "$version" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% } -%> <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index d21aa423b..020809c49 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -190,24 +190,17 @@ chaincodeInstall() { "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" } -chaincodeInstallCCaaS() { - set -x - - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_IMAGE=$5 - local EXTERNAL_PORT=$6 - local CA_CERT=$7 +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" - # Install the chaincode - INSTALL_RESPONSE="$(chaincodeInstall "$CLI_NAME" "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_VERSION" "$CA_CERT")" - echo "INSTALL_RESPONSE: $INSTALL_RESPONSE" - # Query installed chaincodes to get the package ID local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -222,35 +215,17 @@ chaincodeInstallCCaaS() { --output json \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" )" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" - + if [ -z "$PACKAGE_ID" ]; then echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" exit 1 fi - - echo "PACKAGE_ID: $PACKAGE_ID" - startCCaaSContainer "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$PACKAGE_ID" "$CHAINCODE_IMAGE" "$EXTERNAL_PORT" -} - -startCCaaSContainer() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" - local EXTERNAL_PORT="$6" - - local PACKAGE_HASH="${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="ccaas-${PEER_ADDRESS%%:*}-${CHAINCODE_NAME}" + echo "PACKAGE_ID: $PACKAGE_ID" - # If PACKAGE_HASH is empty, use the full CC_PACKAGE_ID - if [ -z "$PACKAGE_HASH" ]; then - PACKAGE_HASH="$CC_PACKAGE_ID" - fi + local PACKAGE_HASH="${PACKAGE_ID#*:}" echo "Starting CCaaS container: $CONTAINER_NAME with ID: ${CHAINCODE_LABEL}:${PACKAGE_HASH}" @@ -272,24 +247,6 @@ startCCaaSContainer() { # Use generated CCAAS certificates local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" - # Verify CCAAS TLS files exist - local REQUIRED_TLS_FILES=( - "$CCAAS_TLS_PATH/client.key" - "$CCAAS_TLS_PATH/client.crt" - "$CCAAS_TLS_PATH/peer.crt" - ) - - echo "Verifying CCAAS TLS files exist for $CONTAINER_NAME..." - for file in "${REQUIRED_TLS_FILES[@]}"; do - if [ ! -f "$file" ]; then - echo "ERROR: Required CCAAS TLS file missing: $file" - exit 1 - fi - echo "✓ Found: $file" - done - - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true - docker run -d \ --name "$CONTAINER_NAME" \ -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \ @@ -366,7 +323,6 @@ chaincodeApprove() { --output json \ "${CA_CERT_PARAMS[@]+"${CA_CERT_PARAMS[@]}"}" )" - echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\"$CHAINCODE_LABEL\") ][0].package_id // \"\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" From 237dfb4a29fbe5dd953b136f3829503a114e47d9 Mon Sep 17 00:00:00 2001 From: Sanket Teli Date: Fri, 25 Oct 2024 15:27:45 +0530 Subject: [PATCH 439/471] added the tests Signed-off-by: Sanket Teli Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-05.sh | 93 +++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 e2e-network/docker/test-05.sh diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh new file mode 100644 index 000000000..808b6336f --- /dev/null +++ b/e2e-network/docker/test-05.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +set -eux + +TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" +TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" +FABLO_HOME="$TEST_TMP/../../.." + +CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" + +networkUp() { + "$FABLO_HOME/fablo-build.sh" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) +} + +dumpLogs() { + echo "Saving logs of $1 to $TEST_LOGS/$1.log" + mkdir -p "$TEST_LOGS" + docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 +} + +networkDown() { + rm -rf "$TEST_LOGS" + (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) + dumpLogs orderer0.group1.orderer.example.com + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) +} + +waitForContainer() { + sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" +} + +waitForChaincode() { + (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") +} + +expectInvoke() { + (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "$6") +} + +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + +trap networkDown EXIT +trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT + +# start the network +networkUp + +waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" +waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" +waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" +waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" +waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" +waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" +waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" + +# Test simple chaincode +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ + '{\"success\":\"OK\"}' +expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"success\":\"Willy Wonka\"}' + +# Verify channel query scripts +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) +expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 4 my-channel1 org1 peer1 "another.block") +expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" + +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") +expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," + +expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":6" + +# Reset and ensure the state is lost after reset +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) +waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:get", "name"]}' \ + '{\"error\":\"NOT_FOUND\"}' + +# Put some data again +expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ + '{"Args":["KVContract:put", "name", "James Bond"]}' \ + '{\"success\":\"OK\"}' \ No newline at end of file From 098cc0901269a977855f6d3d504d08f8f6c55171 Mon Sep 17 00:00:00 2001 From: Debayan Ghosh <66942246+debayangg@users.noreply.github.com> Date: Mon, 14 Apr 2025 01:03:42 +0530 Subject: [PATCH 440/471] Updated fablo.sh to check if /hooks/post-generate.sh exists (#526) Signed-off-by: Debayan Ghosh Co-authored-by: Debayan Ghosh Signed-off-by: Pereowei Daniel From d1855cc6b6a3fc7d13f1b73534318f29931ea323 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 9 Jun 2025 09:53:15 +0200 Subject: [PATCH 441/471] Fix: Missing FABLO_VERSION in publish docker workflow (#556) Signed-off-by: Pereowei Daniel --- .github/workflows/publish-docker-on-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index bce9c9ff8..e7982fd80 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -34,6 +34,7 @@ jobs: - name: Build and push node chaincode run: | + FABLO_VERSION=$(cat package.json | jq -r '.version') docker buildx build \ --platform linux/amd64,linux/arm64 \ --tag "ghcr.io/fablo-io/fablo-kv-node-chaincode-sample:$FABLO_VERSION" \ From d11624a1a2b4cb91d8298387a0a46c3b1dce7d1f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel <82245725+dpereowei@users.noreply.github.com> Date: Mon, 16 Jun 2025 11:00:18 +0100 Subject: [PATCH 442/471] Coverage tracker document (#557) Signed-off-by: Pereowei Daniel --- COVERAGE_TRACKER.md | 95 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 COVERAGE_TRACKER.md diff --git a/COVERAGE_TRACKER.md b/COVERAGE_TRACKER.md new file mode 100644 index 000000000..7f756a7c8 --- /dev/null +++ b/COVERAGE_TRACKER.md @@ -0,0 +1,95 @@ +# 🧪 Fablo Feature Coverage Tracker + +This document tracks the progress of testing and documenting Fablo features across different Fabric versions. + +Legend: +❔ = unknown status
+✅ = completed +❌ = not done +🔄 = in progress +🔗 = link to related issue/todo + +--- + +## Network Topology + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|----------------------------------|-----------|-----------|--------|-------------|----------------------| +| Solo Consensus | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| RAFT Consensus | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| BFT Consensus | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| TLS | ❔ | ❔ | ❔ | ❔ | | +| Orderer Groups | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| Peer DB - LevelDB | ❔ | ❔ | ❔ | ❔ | | +| Peer DB - CouchDB | ❔ | ❔ | ❔ | ❔ | | +| CA DB - SQLite | ❔ | ❔ | ❔ | ❔ | | +| CA DB - Postgres | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| CA DB - MySQL | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | + +--- + +## Channels + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|-------------------------|-----------|-----------|--------|-------------|----------------------| +| Channel query scripts | ❔ | ❔ | ❔ | ❔ | | + +--- + +## Chaincodes + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|-----------------------------------|-----------|-----------|--------|-------------|----------------------| +| Node | ❔ | ❔ | ❔ | ❔ | | +| Go | ❔ | ❔ | ❔ | ❔ | | +| Java | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| Chaincode-as-a-Service (CCaaS) | ❔ | ❔ | ❔ | ❔ | | +| Endorsement Policies | ❔ | ❔ | ❔ | ❔ | | +| Multi-org Endorsements | ❔ | ❔ | ❔ | ❔ | | +| Private Data Collections | ❔ | ❔ | ❔ | ❔ | | +| Chaincode scripts (list/query/invoke) | ❔ | ❔ | ❔ | ❔ | | +| Commands: install / upgrade | ❔ | ❔ | ❔ | ❔ | | + +--- + +## Tools + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|---------------|-----------|-----------|--------|-------------|----------------------| +| Fablo REST | ❔ | ❔ | ❔ | ❔ | | +| Explorer | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | + +--- + +## Fablo Commands + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|----------------------------------------|-----------|-----------|--------|-------------|----------------------| +| `generate` | ❔ | ❔ | ❔ | ❔ | | +| `up`, `start`, `stop`, `down`, `reset`, `recreate` | ❔ | ❔ | ❔ | ❔ | | +| `validate`, `extendConfig` | ❔ | ❔ | ❔ | ❔ | | +| `update`, `version` | ❔ | ❔ | ❔ | ❔ | | +| `init` (node, rest, dev) | ❔ | ❔ | ❔ | ❔ | | +| Other init options | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | + +--- + +## Snapshot + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|------------------------|-----------|-----------|--------|-------------|----------------------| +| Create snapshot | ❔ | ❔ | ❔ | ❔ | | +| Restore snapshot | ❔ | ❔ | ❔ | ❔ | | +| Post-restore hook | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | + +--- + +## Other Features + +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|------------------------|-----------|-----------|--------|-------------|----------------------| +| Peer dev mode | ❔ | ❔ | ❔ | ❔ | | +| Connection profiles | ❔ | ❔ | ❔ | ❔ | | +| Gateway client | ❔ | ❔ | ❔ | ❔ | | +| Hooks: post-generate | ❔ | ❔ | ❔ | ❔ | | +| JSON/YAML support | ❔ | ❔ | ❔ | ❔ | | \ No newline at end of file From d6871b7ce6f6ba463fbe508c79bcc352da9285fc Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Mon, 7 Jul 2025 12:06:41 +0300 Subject: [PATCH 443/471] Update coverage tracker Snapshot (#564) Signed-off-by: Pereowei Daniel --- COVERAGE_TRACKER.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/COVERAGE_TRACKER.md b/COVERAGE_TRACKER.md index 7f756a7c8..65ca62d73 100644 --- a/COVERAGE_TRACKER.md +++ b/COVERAGE_TRACKER.md @@ -78,9 +78,9 @@ Legend: | Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | |------------------------|-----------|-----------|--------|-------------|----------------------| -| Create snapshot | ❔ | ❔ | ❔ | ❔ | | -| Restore snapshot | ❔ | ❔ | ❔ | ❔ | | -| Post-restore hook | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| Create snapshot | ✅ | ✅ | ✅ | ✅ | | +| Restore snapshot | ✅ | ✅ | ✅ | ✅ | | +| Post-start hook | ❔ | ❔ | ❔ | ❔ | [Add post-start hooks](https://github.com/hyperledger-labs/fablo/issues/111) | --- From da7ba0632d0742b23c0f2e9caa426ae87f7ae180 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel <82245725+dpereowei@users.noreply.github.com> Date: Fri, 11 Jul 2025 03:26:50 -0500 Subject: [PATCH 444/471] Update coverage tracker markdown with network topology tests (#562) Signed-off-by: Pereowei Daniel --- COVERAGE_TRACKER.md | 52 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/COVERAGE_TRACKER.md b/COVERAGE_TRACKER.md index 65ca62d73..800a93fbb 100644 --- a/COVERAGE_TRACKER.md +++ b/COVERAGE_TRACKER.md @@ -7,24 +7,26 @@ Legend: ✅ = completed ❌ = not done 🔄 = in progress -🔗 = link to related issue/todo +🔗 = link to related issue/todo +Fabric v2 = 2.5.9 +Fabric v3 = 3.0.0 --- ## Network Topology -| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | -|----------------------------------|-----------|-----------|--------|-------------|----------------------| -| Solo Consensus | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | -| RAFT Consensus | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | -| BFT Consensus | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | -| TLS | ❔ | ❔ | ❔ | ❔ | | -| Orderer Groups | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | -| Peer DB - LevelDB | ❔ | ❔ | ❔ | ❔ | | -| Peer DB - CouchDB | ❔ | ❔ | ❔ | ❔ | | -| CA DB - SQLite | ❔ | ❔ | ❔ | ❔ | | -| CA DB - Postgres | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | -| CA DB - MySQL | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|----------------------------------|-----------|-----------|--------|-------------|-----------------------------------------------------------------------| +| Solo Consensus | ✅ | ❌ | ✅ | ✅ | | +| RAFT Consensus | ✅ | ✅ | ✅ | ✅ | | +| BFT Consensus | ❌ | ✅ | ✅ | ✅ | [559](https://github.com/hyperledger-labs/fablo/issues/559) | +| TLS | ✅ | ✅ | ✅ | ✅ | | +| Orderer Groups | ✅ | ❌ | ✅ | ✅ | [560](https://github.com/hyperledger-labs/fablo/issues/560) | +| Peer DB - LevelDB | ✅ | ✅ | ✅ | ✅ | | +| Peer DB - CouchDB | ✅ | ✅ | ✅ | ✅ | | +| CA DB - SQLite | ✅ | ✅ | ✅ | ✅ | | +| CA DB - Postgres | ✅ | ✅ | ✅ | ✅ | | +| CA DB - MySQL | ❌ | ❌ | ❌ | ✅ | [561](https://github.com/hyperledger-labs/fablo/issues/561) | --- @@ -32,7 +34,7 @@ Legend: | Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | |-------------------------|-----------|-----------|--------|-------------|----------------------| -| Channel query scripts | ❔ | ❔ | ❔ | ❔ | | +| Channel query scripts | ✅ | ✅ | ✅ | ❔ | | --- @@ -40,15 +42,15 @@ Legend: | Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | |-----------------------------------|-----------|-----------|--------|-------------|----------------------| -| Node | ❔ | ❔ | ❔ | ❔ | | -| Go | ❔ | ❔ | ❔ | ❔ | | -| Java | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | -| Chaincode-as-a-Service (CCaaS) | ❔ | ❔ | ❔ | ❔ | | -| Endorsement Policies | ❔ | ❔ | ❔ | ❔ | | -| Multi-org Endorsements | ❔ | ❔ | ❔ | ❔ | | -| Private Data Collections | ❔ | ❔ | ❔ | ❔ | | -| Chaincode scripts (list/query/invoke) | ❔ | ❔ | ❔ | ❔ | | -| Commands: install / upgrade | ❔ | ❔ | ❔ | ❔ | | +| Node | ✅ | ✅ | ✅ | ❔ | | +| Go | ✅ | ✅ | ✅ | ❔ | | +| Java | ✅ | ✅ | ✅ | ❔ | | +| Chaincode-as-a-Service (CCaaS) | ❌ | ❌ | ✅ | ❔ | | +| Endorsement Policies | ✅ | ✅ | ✅ | ❔ | | +| Multi-org Endorsements | ✅ | ✅ | ✅ | ❔ | | +| Private Data Collections | ✅ | ✅ | ✅ | ❔ | | +| Chaincode scripts (list/query/invoke) | ✅ | ✅ | ✅ | ❔ | | +| Commands: install / upgrade | ✅ | ✅ | ✅ | ❔ | | --- @@ -56,8 +58,8 @@ Legend: | Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | |---------------|-----------|-----------|--------|-------------|----------------------| -| Fablo REST | ❔ | ❔ | ❔ | ❔ | | -| Explorer | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| Fablo REST | ✅ | ✅ | ✅ | ❔ | | +| Explorer | ✅ | ❌ | ✅ | ❔ | | --- From d3ff754fdfbfca1fd8bdc3e4694eb8cffad43ebd Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Fri, 11 Jul 2025 11:28:20 +0300 Subject: [PATCH 445/471] Update coverage for 'Other Features' (#566) Signed-off-by: Pereowei Daniel --- COVERAGE_TRACKER.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/COVERAGE_TRACKER.md b/COVERAGE_TRACKER.md index 800a93fbb..7c8d2fb70 100644 --- a/COVERAGE_TRACKER.md +++ b/COVERAGE_TRACKER.md @@ -90,8 +90,8 @@ Fabric v3 = 3.0.0 | Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | |------------------------|-----------|-----------|--------|-------------|----------------------| -| Peer dev mode | ❔ | ❔ | ❔ | ❔ | | -| Connection profiles | ❔ | ❔ | ❔ | ❔ | | -| Gateway client | ❔ | ❔ | ❔ | ❔ | | -| Hooks: post-generate | ❔ | ❔ | ❔ | ❔ | | -| JSON/YAML support | ❔ | ❔ | ❔ | ❔ | | \ No newline at end of file +| Peer dev mode |✅ |❌ | ❌ |✅ |[Support dev mode for Fabric v3](https://github.com/hyperledger-labs/fablo/issues/472) | +| Connection profiles |✅ |✅ |✅ |✅ | | +| Gateway client | ❔ | ❔ | ❔ | ❔ |[Adds gateway option to init](https://github.com/hyperledger-labs/fablo/pull/544) | +| Hooks: post-generate |✅ |✅ |✅ |✅ | | +| JSON/YAML support |✅ |✅ |✅ |✅ | | \ No newline at end of file From e77a2f6ba0e23c00a1025a0bf421ae2007758749 Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:12:56 +0300 Subject: [PATCH 446/471] Update coverage tracker Fablo Commands section (#563) Signed-off-by: Pereowei Daniel --- COVERAGE_TRACKER.md | 16 ++++++++-------- README.md | 8 ++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/COVERAGE_TRACKER.md b/COVERAGE_TRACKER.md index 7c8d2fb70..7eb91bf70 100644 --- a/COVERAGE_TRACKER.md +++ b/COVERAGE_TRACKER.md @@ -65,14 +65,14 @@ Fabric v3 = 3.0.0 ## Fablo Commands -| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | -|----------------------------------------|-----------|-----------|--------|-------------|----------------------| -| `generate` | ❔ | ❔ | ❔ | ❔ | | -| `up`, `start`, `stop`, `down`, `reset`, `recreate` | ❔ | ❔ | ❔ | ❔ | | -| `validate`, `extendConfig` | ❔ | ❔ | ❔ | ❔ | | -| `update`, `version` | ❔ | ❔ | ❔ | ❔ | | -| `init` (node, rest, dev) | ❔ | ❔ | ❔ | ❔ | | -| Other init options | ❔ | ❔ | ❔ | ❔ | [#TODO](#) | +| Feature | Fabric v2 | Fabric v3 | Tested | Documented | Todo / Issue | +|-------------------------------------------------------------------------|-----------|-----------|--------|----------|------------------------------------------------------------------------------| +| `generate` | ✅ | ✅ | ✅ | ✅ | | +| `up`, `start`, `stop`, `down`, `reset`, `recreate` | ✅ | ✅ | ✅ | ✅ | | +| `validate`, `extend-config` | ✅ | ✅ | ✅ | ✅ | | +| `version` | ✅ | ✅ | ✅ | ✅ | | +| `init` (node, rest, dev) | ✅ | ✅ | ✅ | ✅ | | +| Other `init` options | ❔ | ❔ | ❔ | ❔ | [Add CLI options to init command](https://github.com/hyperledger-labs/fablo/issues/444) | --- diff --git a/README.md b/README.md index 5123feb4d..82daf842c 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,14 @@ fablo validate [/path/to/fablo-config.json|yaml] Validates network config. This command will validate your network config try to suggest necessary changes or additional tweaks. Please note that this step is also executed automatically before each `generate` to ensure that at least critical errors where fixed. +### extend-config + +```bash +fablo extend-config [/path/to/fablo-config.json|yaml] +``` + +Generates an extended version of the Fablo config by filling in default and computed values based on the provided configuration file and making some config parts more verbos. + ### snapshot and restore Fablo supports saving state snapshot (backup) of the network and restoring it. From 707e1a5d177d492059447f9f24858fb477112292 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 14 Jul 2025 15:40:12 +0200 Subject: [PATCH 447/471] Pre-review fixes Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- .github/workflows/publish-docker-on-main.yml | 2 +- .github/workflows/test-on-push.yml | 38 ++++---- .gitignore | 2 +- docs/schema.json | 7 -- e2e-network/docker/test-01-simple.sh | 4 +- e2e-network/docker/test-04-snapshot.sh | 4 +- e2e-network/docker/test-05-version3-BFT.sh | 87 ------------------- e2e-network/docker/test-05-version3.sh | 84 ------------------ src/repositoryUtils.test.ts | 40 +-------- .../fabric-docker/commands-generated.sh | 2 +- .../chaincode-install-v2.sh | 5 +- .../fabric-docker/docker-compose.yaml | 2 +- .../scripts/chaincode-functions-v2.sh | 18 ++-- src/types/FabloConfigExtended.ts | 2 +- src/utils/parseFabloConfig.test.ts | 52 +++++------ 15 files changed, 64 insertions(+), 285 deletions(-) delete mode 100755 e2e-network/docker/test-05-version3-BFT.sh delete mode 100755 e2e-network/docker/test-05-version3.sh diff --git a/.github/workflows/publish-docker-on-main.yml b/.github/workflows/publish-docker-on-main.yml index e7982fd80..c76586b28 100644 --- a/.github/workflows/publish-docker-on-main.yml +++ b/.github/workflows/publish-docker-on-main.yml @@ -39,4 +39,4 @@ jobs: --platform linux/amd64,linux/arm64 \ --tag "ghcr.io/fablo-io/fablo-kv-node-chaincode-sample:$FABLO_VERSION" \ --push \ - samples/chaincodes/chaincode-kv-node + samples/chaincodes/chaincode-kv-node \ No newline at end of file diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index db02f3be2..c4e4da805 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -40,7 +40,6 @@ jobs: - name: Lint run: npm run lint && ./lint.sh - # test-k8: # needs: test-main # runs-on: ubuntu-latest @@ -168,20 +167,20 @@ jobs: with: name: test-04-snapshot path: | - e2e-network/docker/test-04-snapshot.sh.logs/* - e2e-network/docker/test-04-snapshot.sh.tmpdir/fablo-target/**/* - + e2e-network/docker/test-04-v2-snapshot.sh.logs/* + e2e-network/docker/test-04-v2-snapshot.sh.tmpdir/fablo-target/**/* + test-05-v3: needs: test-main - runs-on: macos-15 + runs-on: macos-15 steps: - name: Check out repository code uses: actions/checkout@v2 - + - name: Install Docker + Colima run: | brew update - brew install qemu colima docker + brew install qemu colima docker brew uninstall --ignore-dependencies lima curl https://raw.githubusercontent.com/Homebrew/homebrew-core/45464b6c4788a80be3f131ab5e2a4468cdfa960c/Formula/l/lima.rb > lima.rb brew install lima.rb @@ -199,24 +198,23 @@ jobs: npm install -g npm@latest npm install - - name: Build Fablo run: | shellcheck --version && \ yamllint -v && \ npm install && \ ./fablo-build.sh - + - name: Test version 3 - run: e2e-network/docker/test-05-version3.sh - + run: e2e-network/docker/test-05-v3.sh + - uses: actions/upload-artifact@v4 if: always() with: name: test-05-version3 path: | - e2e-network/docker/test-05-version3-snapshot.sh.logs/* - e2e-network/docker/test-05-version3-snapshot.sh.tmpdir/fablo-target/**/* + e2e-network/docker/test-05-v3.sh.logs/* + e2e-network/docker/test-05-v3.sh.tmpdir/fablo-target/**/* test-05-v3-BFT: needs: test-main @@ -224,23 +222,21 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v2 - + - name: Build Fablo run: | shellcheck --version && \ yamllint -v && \ npm install && \ ./fablo-build.sh - + - name: Test version 3 with BFT - run: e2e-network/docker/test-05-version3-BFT.sh - + run: e2e-network/docker/test-06-v3-bft.sh + - uses: actions/upload-artifact@v4 if: always() with: name: test-05-version3-BFT-snapshot path: | - e2e-network/docker/test-05-version3-BFT-snapshot.sh.logs/* - e2e-network/docker/test-05-version3-BFT-snapshot.sh.tmpdir/fablo-target/**/* - - + e2e-network/docker/test-06-v3-bft.sh.logs/* + e2e-network/docker/test-06-v3-bft.sh.tmpdir/fablo-target/**/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index e630d9167..b4c27d5d8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ node_modules .idea .vscode samples/invalid-fablo-config.json -**/.DS_Store \ No newline at end of file +.DS_Store diff --git a/docs/schema.json b/docs/schema.json index f66d2aaae..23b7bd8cb 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -496,13 +496,6 @@ "title": "Chaincode image URI", "type": "string" }, - "port": { - "$id": "#/properties/chaincodes/items/properties/port", - "title": "Chaincode port", - "type": "integer", - "minimum": 10, - "maximum": 65535 - }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "title": "Private data collections", diff --git a/e2e-network/docker/test-01-simple.sh b/e2e-network/docker/test-01-simple.sh index 3c21fc023..2a0ea3093 100755 --- a/e2e-network/docker/test-01-simple.sh +++ b/e2e-network/docker/test-01-simple.sh @@ -81,7 +81,7 @@ expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my- # Reset and ensure the state is lost after reset (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -# waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:get", "name"]}' \ '{\"error\":\"NOT_FOUND\"}' @@ -91,4 +91,4 @@ expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "James Bond"]}' \ '{\"success\":\"OK\"}' -echo "✅ Test passed!" \ No newline at end of file +echo "✅ Test passed!" diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index b853dc42c..25277b00b 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -9,7 +9,6 @@ FABLO_HOME="$TEST_TMP/../../.." export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json" -CHAINCODE_SRC="$FABLO_HOME/samples/chaincodes/chaincode-kv-node" networkUp() { "$FABLO_HOME/fablo-build.sh" @@ -58,7 +57,6 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" -# waitForContainer "chaincode1_peer0.org1.example.com" "Bootstrap process completed" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" @@ -130,3 +128,5 @@ expectInvokeRest "$fablo_rest_org1 $user_token" "my-channel1" "chaincode1" \ expectInvokeRest "$fablo_rest_org1 $user_token" "my-channel1" "chaincode1" \ "KVContract:getPrivateMessage" '["_implicit_org_Org1MSP"]' \ '{"success":"RHIgVmljdG9yIEZyaWVz"}' + +echo "✅ Test passed!" diff --git a/e2e-network/docker/test-05-version3-BFT.sh b/e2e-network/docker/test-05-version3-BFT.sh deleted file mode 100755 index 42d3b5754..000000000 --- a/e2e-network/docker/test-05-version3-BFT.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" -TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" -FABLO_HOME="$TEST_TMP/../../.." - -export FABLO_HOME - -CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json" - -networkUp() { - "$FABLO_HOME/fablo-build.sh" - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) -} - -dumpLogs() { - echo "Saving logs of $1 to $TEST_LOGS/$1.log" - mkdir -p "$TEST_LOGS" - docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 -} - -networkDown() { - rm -rf "$TEST_LOGS" - (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - dumpLogs orderer0.group1.orderer.example.com - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) -} - -waitForContainer() { - sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" -} - -waitForChaincode() { - (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") -} - -expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") -} - -expectCommand() { - sh "$TEST_TMP/../expect-command.sh" "$1" "$2" -} - -trap networkDown EXIT -trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT - -# start the network -networkUp - -waitForContainer "orderer0.group1.orderer.example.com" "Channel created" -waitForContainer "orderer1.group1.orderer.example.com" "Channel created" -waitForContainer "orderer2.group1.orderer.example.com" "Channel created" -waitForContainer "orderer3.group1.orderer.example.com" "Channel created" -waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" -waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" - -# Test simple chaincode -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ - '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' - -# Verify channel query scripts -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) -expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") -expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") -expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," - -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" - -echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/e2e-network/docker/test-05-version3.sh b/e2e-network/docker/test-05-version3.sh deleted file mode 100755 index 5f08f5cf8..000000000 --- a/e2e-network/docker/test-05-version3.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash - -set -eu - -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" -TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" -FABLO_HOME="$TEST_TMP/../../.." - -export FABLO_HOME - -CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" - -networkUp() { - "$FABLO_HOME/fablo-build.sh" - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) -} - -dumpLogs() { - echo "Saving logs of $1 to $TEST_LOGS/$1.log" - mkdir -p "$TEST_LOGS" - docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 -} - -networkDown() { - rm -rf "$TEST_LOGS" - (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - dumpLogs orderer0.group1.orderer.example.com - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) -} - -waitForContainer() { - sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" -} - -waitForChaincode() { - (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") -} - -expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "") -} - -expectCommand() { - sh "$TEST_TMP/../expect-command.sh" "$1" "$2" -} - -trap networkDown EXIT -trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT - -# start the network -networkUp - -waitForContainer "orderer0.group1.orderer.example.com" "Starting raft node as part of a new channel channel=my-channel1" -waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" -waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" - -# Test simple chaincode -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ - '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' - -# Verify channel query scripts -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) -expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 3 my-channel1 org1 peer1 "another.block") -expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") -expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," - -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":5" - -echo "🎉 Test passed! 🎉" \ No newline at end of file diff --git a/src/repositoryUtils.test.ts b/src/repositoryUtils.test.ts index 86cc22f48..029c866c5 100644 --- a/src/repositoryUtils.test.ts +++ b/src/repositoryUtils.test.ts @@ -1,47 +1,18 @@ import { sortVersions, version } from "./repositoryUtils"; describe("repositoryUtils", () => { - it("should sort versions", () => { - const unsorted = [ - "0.0.2", - "0.0.2-unstable", - "0.0.1", - "0.1.11", - "0.1.1", - "0.1.1-unstable", - "1.21.2", - ]; + const unsorted = ["0.0.2", "0.0.2-unstable", "0.0.1", "0.1.11", "0.1.1", "0.1.1-unstable", "1.21.2"]; - const expected = [ - "1.21.2", - "0.1.11", - "0.1.1", - "0.0.2", - "0.0.1", - "0.1.1-unstable", - "0.0.2-unstable", - ]; + const expected = ["1.21.2", "0.1.11", "0.1.1", "0.0.2", "0.0.1", "0.1.1-unstable", "0.0.2-unstable"]; expect(sortVersions(unsorted)).toEqual(expected); }); it("should place pre‑release (named) tags after the matching stable tag", () => { - const unsorted = [ - "0.1.1-alpha", - "0.1.1-beta", - "0.1.2-alpha", - "0.1.2", - "0.1.1", - ]; + const unsorted = ["0.1.1-alpha", "0.1.1-beta", "0.1.2-alpha", "0.1.2", "0.1.1"]; - const expected = [ - "0.1.2", - "0.1.1", - "0.1.2-alpha", - "0.1.1-beta", - "0.1.1-alpha", - ]; + const expected = ["0.1.2", "0.1.1", "0.1.2-alpha", "0.1.1-beta", "0.1.1-alpha"]; expect(sortVersions(unsorted)).toEqual(expected); }); @@ -52,7 +23,6 @@ describe("repositoryUtils", () => { expect(sortVersions(unsorted)).toEqual(expected); }); - it("should compare versions", () => { expect(version("1.4.0").isGreaterOrEqual("1.4.0")).toBe(true); expect(version("1.4.0").isGreaterOrEqual("1.4.1")).toBe(false); @@ -69,14 +39,12 @@ describe("repositoryUtils", () => { expect(version("0.0.1").isGreaterOrEqual("0.0.1-alpha")).toBe(true); }); - it("should check membership with isOneOf()", () => { const list = ["1.2.3", "2.0.0", "3.1.4-alpha"]; expect(version("1.2.3").isOneOf(list)).toBe(true); expect(version("3.1.4").isOneOf(list)).toBe(false); }); - it("should take major.minor fragments only", () => { expect(version("10.5.7").takeMajorMinor()).toBe("10.5"); expect(version("2.0.0-beta").takeMajorMinor()).toBe("2.0"); diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 8c71fb984..71ac171e2 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -250,7 +250,7 @@ networkDown() { <% chaincodes.forEach((chaincode) => { -%> <% chaincode.channel.orgs.forEach((org) => { -%> <% org.peers.forEach((peer) => { -%> - <% const chaincodeContainerName=`ccaas-` -%> + <% const chaincodeContainerName=`${peer.address}-${chaincode.name}` -%> for container in $(docker ps -a | grep "<%= chaincodeContainerName %>" | awk '{print $1}'); do echo "Removing container $container..."; docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted"; done for image in $(docker images "<%= chaincodeContainerName %>*" -q); do echo "Removing image $image..."; docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted"; done <% }) -%> diff --git a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh index 7330ccaa5..e68eca65b 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated/chaincode-install-v2.sh @@ -15,7 +15,6 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "<%= instance.peerAddress %>" <% -%> "<%= chaincode.name %>" <% -%> "$version" <% -%> - "<%= chaincode.lang %>" <% -%> "<%= chaincode.image %>" <% -%> "<%= instance.port %>" <% -%> "<%= instance.containerName %>" <% -%> @@ -62,7 +61,7 @@ printHeadline "Packaging chaincode '<%= chaincode.name %>'" "U1F60E" "$version" <% -%> "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= chaincode.initRequired %>" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> "<%= chaincode.privateDataConfigFile || '' %>" <% -%> "<%= chaincode.lang %>" <% -%> @@ -77,7 +76,7 @@ chaincodeCommit <% -%> "$version" <% -%> "<%= chaincode.channel.ordererHead.fullAddress %>" <% -%> "<%- chaincode.endorsement || '' %>" <% -%> - "<%= `${chaincode.initRequired}` %>" <% -%> + "<%= chaincode.initRequired %>" <% -%> "<%= !global.tls ? '' : `crypto-orderer/tlsca.${chaincode.channel.ordererHead.domain}-cert.pem` %>" <% -%> "<%= chaincode.channel.orgs.map((o) => o.headPeer.fullAddress).join(',') %>" <% -%> "<%= !global.tls ? '' : chaincode.channel.orgs.map(o => `crypto-peer/${o.headPeer.address}/tls/ca.crt`).join(',') %>" <% -%> diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index df5e3489f..66c6d0ca3 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -1,7 +1,7 @@ networks: basic: -services: +services: <% orgs.forEach(function(org){ %> <%= org.ca.address %>: container_name: <%= org.ca.address %> diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 020809c49..86082ec5f 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -107,15 +107,13 @@ chaincodePackageCCaaS() { local CHAINCODE_NAME=$3 local CHAINCODE_VERSION=$4 local CHAINCODE_LABEL="${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" inputLog "PEER_ADDRESS: $PEER_ADDRESS" inputLog "CLI_NAME: $CLI_NAME" inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" @@ -127,7 +125,7 @@ chaincodePackageCCaaS() { local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" mkdir -p "$PACKAGE_DIR" - echo "{\"type\":\"$CHAINCODE_LANG\",\"label\":\"$CHAINCODE_LABEL\"}" >"$PACKAGE_DIR/metadata.json" + echo "{\"type\":\"ccaas\",\"label\":\"$CHAINCODE_LABEL\"}" >"$PACKAGE_DIR/metadata.json" mkdir -p "$PACKAGE_DIR/code" @@ -231,11 +229,9 @@ startCCaaSContainer() { # Extract peer name and organization domain from peer address local PEER_NAME="${PEER_ADDRESS%%:*}" + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\.//') local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" - # The connection.json expects the container to be accessible on CONTAINER_PORT (17041) - # The container internally listens on 7052, so we map EXTERNAL_PORT:7052 - # This allows the peer to connect to EXTERNAL_PORT and reach the container's 7052 port local PORT_MAP="${EXTERNAL_PORT}:7052" local NETWORK=$(docker inspect "${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') @@ -280,7 +276,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=${10} - local CHAINCODE_LANG=${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -293,7 +288,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then diff --git a/src/types/FabloConfigExtended.ts b/src/types/FabloConfigExtended.ts index 13be30f3c..d4ab6900e 100644 --- a/src/types/FabloConfigExtended.ts +++ b/src/types/FabloConfigExtended.ts @@ -145,7 +145,7 @@ export interface OrgConfig { tools: { fabloRest?: FabloRestConfig; explorer?: ExplorerConfig }; } -export interface peerChaincodeInstances{ +export interface peerChaincodeInstances { containerName: string; peerAddress: string; port: number; diff --git a/src/utils/parseFabloConfig.test.ts b/src/utils/parseFabloConfig.test.ts index 77de1894a..eba214878 100644 --- a/src/utils/parseFabloConfig.test.ts +++ b/src/utils/parseFabloConfig.test.ts @@ -19,21 +19,21 @@ describe("parseFabloConfig", () => { }`; const result = parseFabloConfig(jsonConfig); - + expect(result).toEqual({ global: { fabricVersion: "2.5.9", tls: false, - engine: "docker" + engine: "docker", }, orgs: [ { organization: { name: "Org1", - domain: "org1.example.com" - } - } - ] + domain: "org1.example.com", + }, + }, + ], }); }); @@ -55,16 +55,16 @@ describe("parseFabloConfig", () => { global: { fabricVersion: "2.5.9", tls: false, - engine: "docker" + engine: "docker", }, orgs: [ { organization: { name: "Org1", - domain: "org1.example.com" - } - } - ] + domain: "org1.example.com", + }, + }, + ], }); }); @@ -100,7 +100,7 @@ describe("parseFabloConfig", () => { global: { fabricVersion: "2.4.7", tls: true, - engine: "kubernetes" + engine: "kubernetes", }, orgs: [ { @@ -110,14 +110,14 @@ describe("parseFabloConfig", () => { peers: [ { name: "peer0", - port: 7041 + port: 7041, }, { - name: "peer1", - port: 7042 - } - ] - } + name: "peer1", + port: 7042, + }, + ], + }, }, { organization: { @@ -126,18 +126,18 @@ describe("parseFabloConfig", () => { peers: [ { name: "peer0", - port: 8041 - } - ] - } - } + port: 8041, + }, + ], + }, + }, ], channels: [ { name: "mychannel", - orgs: ["Org1", "Org2"] - } - ] + orgs: ["Org1", "Org2"], + }, + ], }); }); From 565605fd8366eef70e255b8449e108d099f0b6c2 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Tue, 15 Jul 2025 11:19:39 +0200 Subject: [PATCH 448/471] ensure read access for generated certs Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...o-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 1 + .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 1 + ...-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 1 + .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 1 + ...-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 1 + .../templates/fabric-docker/scripts/base-functions-v2.sh | 1 + 6 files changed, 6 insertions(+) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index cda0d0c5b..94cbec3c4 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2246,6 +2246,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 9e0d26142..27b21af24 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2115,6 +2115,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 12f206963..5b611e198 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3043,6 +3043,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 9eeeb2dc7..8b507d1de 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4446,6 +4446,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 123b5783f..41bedee08 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4946,6 +4946,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 966e52363..7f0f3758f 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -98,6 +98,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + chmod -R 644 "$OUTPUT_PATH" echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" } From 8da527f8a0da6f21639ece28de66f64ea80e36e7 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 21 Jul 2025 10:48:02 +0200 Subject: [PATCH 449/471] Use chown instead of chmod to handle permission errors Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- .../fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 2 +- .../templates/fabric-docker/scripts/base-functions-v2.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 94cbec3c4..599863a98 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2246,7 +2246,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 27b21af24..2fc81abc3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2115,7 +2115,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5b611e198..7c2045673 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3043,7 +3043,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 8b507d1de..9c8d80324 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4446,7 +4446,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 41bedee08..bd4793031 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4946,7 +4946,7 @@ certsGenerateCCaaS() { ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 7f0f3758f..051bd5dc1 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -98,7 +98,7 @@ EOF ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chmod -R 644 "$OUTPUT_PATH" + chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" } From 6ff6c3d3b9854256d2041324c44d7d69a32c7681 Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Mon, 21 Jul 2025 11:06:56 +0200 Subject: [PATCH 450/471] Move the chown inside alpine container Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- ...onfig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 4 ++-- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 4 ++-- ...nfig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 4 ++-- ...fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 4 ++-- ...nfig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 4 ++-- .../templates/fabric-docker/scripts/base-functions-v2.sh | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 599863a98..1b747b47b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2242,11 +2242,11 @@ certsGenerateCCaaS() { openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 2fc81abc3..15c8cd8ad 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2111,11 +2111,11 @@ certsGenerateCCaaS() { openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 7c2045673..0ef6cf0e6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3039,11 +3039,11 @@ certsGenerateCCaaS() { openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 9c8d80324..78855d486 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4442,11 +4442,11 @@ certsGenerateCCaaS() { openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index bd4793031..9148ad2da 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -4942,11 +4942,11 @@ certsGenerateCCaaS() { openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ -out /certs/client.crt -days 365 -sha256 && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh index 051bd5dc1..fa5215a18 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v2.sh @@ -94,11 +94,11 @@ EOF openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - chown -R "$(id -u):$(id -g)" "$OUTPUT_PATH" echo "TLS certs generated for ${CONTAINER_NAME} at ${OUTPUT_PATH}" } From bf335017cb7ed475da50fa57af71fd00313af64d Mon Sep 17 00:00:00 2001 From: Jakub Dzikowski Date: Fri, 25 Jul 2025 11:44:49 +0200 Subject: [PATCH 451/471] Update fablo config to use CCaaS and add todos Signed-off-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel --- samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json | 4 ++-- .../templates/fabric-docker/commands-generated.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 71969cf3d..c07880f57 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -55,9 +55,9 @@ { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node" + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" } ], "hooks": { diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index 71ac171e2..e3e207ebf 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -28,6 +28,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -241,6 +243,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } From 87e44ee1b63113e9198158371714d308aa806011 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 1 Aug 2025 04:07:02 -0500 Subject: [PATCH 452/471] Fix-ccaas-without-TLS Signed-off-by: Pereowei Daniel --- src/setup-docker/templates/fabric-docker/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 66c6d0ca3..534e4cc95 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -285,9 +285,9 @@ services: <%_ if(peer.gatewayEnabled) { _%> # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + <%_ } _%> # ccaas builder configuration - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"<%= peer.name %><%= org.name %>"} - <%_ } _%> working_dir: /etc/hyperledger/fabric/peer/ command: peer node start <%= global.peerDevMode ? '--peer-chaincodedev=true' : '' %> ports: From 7cc8f7edcce0b886707406db2a322216dae12e4b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Tue, 12 Aug 2025 07:36:58 -0500 Subject: [PATCH 453/471] fix-start chaincodes after restore Signed-off-by: Pereowei Daniel --- README.md | 1 + e2e-network/docker/test-04-snapshot.sh | 1 + e2e/__snapshots__/extendConfig.test.ts.snap | 30 ++++++++++---- ...1chaincode-raft-explorer.json.test.ts.snap | 40 +++++++++++-------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 3 ++ ...2chaincodes-private-data.yaml.test.ts.snap | 3 ++ ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 3 ++ ...1chaincode-raft-explorer.json.test.ts.snap | 15 +++++++ ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 3 ++ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 3 ++ 10 files changed, 77 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 82daf842c..0f861c569 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ Example: 3. Execute `./fablo prune` to destroy the current network. If the network was present, Fablo would not be able to restore the new one from backup. 4. Execute `./fablo restore /tmp/my-snapshot` to restore the network. 5. Execute `./fablo start` to start the restored network. +6. When running external chaincodes(CCAAS), Execute `./fablo chaincodes install` to start the CCAAS container Typically, a snapshot of the network with little data will take less than 1 MB, so it is easy to share. diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index 25277b00b..7258aa48d 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -112,6 +112,7 @@ hook_command="perl -i -pe 's/FABRIC_VERSION=2\.3\.3/FABRIC_VERSION=2\.4\.2/g' ./ "$FABLO_HOME/fablo.sh" prune && "$FABLO_HOME/fablo.sh" restore "$snapshot_name" "$hook_command" && "$FABLO_HOME/fablo.sh" start + "$FABLO_HOME/fablo.sh" chaincodes install ) waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index f422884a2..89078b582 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1888,9 +1888,9 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1974,9 +1974,16 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "peerChaincodeInstances": [], + "peerChaincodeInstances": [ + { + "containerName": "ccaas-peer0.org1.example.com-chaincode1", + "orgDomain": "org1.example.com", + "peerAddress": "peer0.org1.example.com", + "port": 17041, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -11320,9 +11327,9 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` ], "profileName": "MyChannel1", }, - "directory": "./chaincodes/chaincode-kv-node", + "directory": undefined, "endorsement": undefined, - "image": undefined, + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -11406,9 +11413,16 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` }, }, }, - "lang": "node", + "lang": "ccaas", "name": "chaincode1", - "peerChaincodeInstances": [], + "peerChaincodeInstances": [ + { + "containerName": "ccaas-peer0.org1.example.com-chaincode1", + "orgDomain": "org1.example.com", + "peerAddress": "peer0.org1.example.com", + "port": 17041, + }, + ], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 1b747b47b..81966a0c9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1699,6 +1699,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1714,18 +1716,19 @@ installChannels() { } installChaincodes() { - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" fi } @@ -1744,18 +1747,19 @@ installChaincode() { fi if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" fi fi } @@ -1791,18 +1795,19 @@ upgradeChaincode() { fi if [ "$chaincodeName" = "chaincode1" ]; then - if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" - chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" - chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." - echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" fi fi } @@ -1826,6 +1831,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -1909,7 +1915,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: - basic @@ -2022,7 +2028,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - - "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node/:/var/hyperledger/cli/chaincode1/" + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: - basic diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 15c8cd8ad..e15dd2f9c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,6 +1651,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1783,6 +1785,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 0ef6cf0e6..5667f9148 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2365,6 +2365,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -2578,6 +2580,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 78855d486..956466e56 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3467,6 +3467,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3702,6 +3704,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 9148ad2da..8996f3c1a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3801,6 +3801,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3960,6 +3962,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -4303,6 +4306,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4350,6 +4355,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4532,6 +4539,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4579,6 +4588,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4761,6 +4772,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4808,6 +4821,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 48fac71c5..bf8ce1b43 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1731,6 +1731,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1849,6 +1851,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 28629b62a..0a0e4c2cb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1756,6 +1756,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1873,6 +1875,7 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } From 91524b259505a19acabc31b250f36e14f122fef9 Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Mon, 21 Jul 2025 13:17:38 +0300 Subject: [PATCH 454/471] test post-generate hook creation and execution in ci (#580) Signed-off-by: Pereowei Daniel --- e2e-network/docker/expect-command.sh | 2 +- e2e-network/docker/test-02-raft-2orgs.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/e2e-network/docker/expect-command.sh b/e2e-network/docker/expect-command.sh index 83c2d9190..35baeace3 100755 --- a/e2e-network/docker/expect-command.sh +++ b/e2e-network/docker/expect-command.sh @@ -15,7 +15,7 @@ response="$(eval "$command" 2>&1)" echo "$response" -if echo "$response" | grep -a -F "$expected"; then +if echo "$response" | grep -a -E "$expected"; then echo "✅ ok (cli): $command" else echo "❌ failed (cli): $command | expected: $expected" diff --git a/e2e-network/docker/test-02-raft-2orgs.sh b/e2e-network/docker/test-02-raft-2orgs.sh index 793120c3a..66b9b2019 100755 --- a/e2e-network/docker/test-02-raft-2orgs.sh +++ b/e2e-network/docker/test-02-raft-2orgs.sh @@ -10,10 +10,19 @@ export FABLO_HOME CONFIG="$FABLO_HOME/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml" +expectCommand() { + sh "$TEST_TMP/../expect-command.sh" "$1" "$2" +} + networkUp() { # separate generate and up is intentional just to check if it works "$FABLO_HOME/fablo-build.sh" (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") + + + # Check if the hook was executed (MaxMessageCount should be 1) + expectCommand "cat \"$TEST_TMP/fablo-target/fabric-config/configtx.yaml\"" "MaxMessageCount: 1$" + (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) } From b5ffd7976cc9c59e249997a442d90ef9ef8028d3 Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Mon, 21 Jul 2025 13:47:46 +0300 Subject: [PATCH 455/471] Fix Gradle build for Java chaincode (#583) Signed-off-by: Pereowei Daniel --- .../chaincode-java-simple/build.gradle | 16 +- .../gradle/wrapper/gradle-wrapper.jar | Bin 54417 -> 61574 bytes .../gradle/wrapper/gradle-wrapper.properties | 3 +- .../chaincodes/chaincode-java-simple/gradlew | 292 +++++++++++------- .../chaincode-java-simple/gradlew.bat | 176 ++++++----- 5 files changed, 284 insertions(+), 203 deletions(-) diff --git a/samples/chaincodes/chaincode-java-simple/build.gradle b/samples/chaincodes/chaincode-java-simple/build.gradle index 78d92f720..6b136d61a 100644 --- a/samples/chaincodes/chaincode-java-simple/build.gradle +++ b/samples/chaincodes/chaincode-java-simple/build.gradle @@ -6,9 +6,10 @@ plugins { id 'java' } -version '0.0.1' +version = '0.0.1' -sourceCompatibility = 1.8 +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 repositories { mavenLocal() @@ -22,7 +23,7 @@ repositories { } dependencies { - implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.0' + implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.5.0' implementation group: 'org.json', name: 'json', version: '20180813' testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2' testImplementation 'org.assertj:assertj-core:3.11.1' @@ -30,9 +31,9 @@ dependencies { } shadowJar { - baseName = 'chaincode' - version = null - classifier = null + archiveBaseName.set('chaincode') + archiveVersion.set('') + archiveClassifier.set('') manifest { attributes 'Main-Class': 'org.hyperledger.fabric.contract.ContractRouter' @@ -46,7 +47,6 @@ test { } } - tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters" + options.compilerArgs += ["-Xlint:unchecked", "-Xlint:deprecation", "-parameters"] } diff --git a/samples/chaincodes/chaincode-java-simple/gradle/wrapper/gradle-wrapper.jar b/samples/chaincodes/chaincode-java-simple/gradle/wrapper/gradle-wrapper.jar index 758de960ec7947253b058ff79c88ce51f3abe08a..943f0cbfa754578e88a3dae77fce6e3dea56edbf 100644 GIT binary patch literal 61574 zcmb6AV{~QRwml9f72CFLyJFk6ZKq;e729@pY}>YNR8p1vbMJH7ubt# zZR`2@zJD1Ad^Oa6Hk1{VlN1wGR-u;_dyt)+kddaNpM#U8qn@6eX;fldWZ6BspQIa= zoRXcQk)#ENJ`XiXJuK3q0$`Ap92QXrW00Yv7NOrc-8ljOOOIcj{J&cR{W`aIGXJ-` z`ez%Mf7qBi8JgIb{-35Oe>Zh^GIVe-b^5nULQhxRDZa)^4+98@`hUJe{J%R>|LYHA z4K3~Hjcp8_owGF{d~lZVKJ;kc48^OQ+`_2migWY?JqgW&))70RgSB6KY9+&wm<*8 z_{<;(c;5H|u}3{Y>y_<0Z59a)MIGK7wRMX0Nvo>feeJs+U?bt-++E8bu7 zh#_cwz0(4#RaT@xy14c7d<92q-Dd}Dt<*RS+$r0a^=LGCM{ny?rMFjhgxIG4>Hc~r zC$L?-FW0FZ((8@dsowXlQq}ja%DM{z&0kia*w7B*PQ`gLvPGS7M}$T&EPl8mew3In z0U$u}+bk?Vei{E$6dAYI8Tsze6A5wah?d(+fyP_5t4ytRXNktK&*JB!hRl07G62m_ zAt1nj(37{1p~L|m(Bsz3vE*usD`78QTgYIk zQ6BF14KLzsJTCqx&E!h>XP4)bya|{*G7&T$^hR0(bOWjUs2p0uw7xEjbz1FNSBCDb@^NIA z$qaq^0it^(#pFEmuGVS4&-r4(7HLmtT%_~Xhr-k8yp0`$N|y>#$Ao#zibzGi*UKzi zhaV#@e1{2@1Vn2iq}4J{1-ox;7K(-;Sk{3G2_EtV-D<)^Pk-G<6-vP{W}Yd>GLL zuOVrmN@KlD4f5sVMTs7c{ATcIGrv4@2umVI$r!xI8a?GN(R;?32n0NS(g@B8S00-=zzLn z%^Agl9eV(q&8UrK^~&$}{S(6-nEXnI8%|hoQ47P?I0Kd=woZ-pH==;jEg+QOfMSq~ zOu>&DkHsc{?o&M5`jyJBWbfoPBv9Y#70qvoHbZXOj*qRM(CQV=uX5KN+b>SQf-~a8 ziZg}@&XHHXkAUqr)Q{y`jNd7`1F8nm6}n}+_She>KO`VNlnu(&??!(i#$mKOpWpi1 z#WfWxi3L)bNRodhPM~~?!5{TrrBY_+nD?CIUupkwAPGz-P;QYc-DcUoCe`w(7)}|S zRvN)9ru8b)MoullmASwsgKQo1U6nsVAvo8iKnbaWydto4y?#-|kP^%e6m@L`88KyDrLH`=EDx*6>?r5~7Iv~I zr__%SximG(izLKSnbTlXa-ksH@R6rvBrBavt4)>o3$dgztLt4W=!3=O(*w7I+pHY2(P0QbTma+g#dXoD7N#?FaXNQ^I0*;jzvjM}%=+km`YtC%O#Alm| zqgORKSqk!#^~6whtLQASqiJ7*nq?38OJ3$u=Tp%Y`x^eYJtOqTzVkJ60b2t>TzdQ{I}!lEBxm}JSy7sy8DpDb zIqdT%PKf&Zy--T^c-;%mbDCxLrMWTVLW}c=DP2>Td74)-mLl|70)8hU??(2)I@Zyo z2i`q5oyA!!(2xV~gahuKl&L(@_3SP012#x(7P!1}6vNFFK5f*A1xF({JwxSFwA|TM z&1z}!*mZKcUA-v4QzLz&5wS$7=5{M@RAlx@RkJaA4nWVqsuuaW(eDh^LNPPkmM~Al zwxCe@*-^4!ky#iNv2NIIU$CS+UW%ziW0q@6HN3{eCYOUe;2P)C*M`Bt{~-mC%T3%# zEaf)lATO1;uF33x>Hr~YD0Ju*Syi!Jz+x3myVvU^-O>C*lFCKS&=Tuz@>&o?68aF& zBv<^ziPywPu#;WSlTkzdZ9`GWe7D8h<1-v0M*R@oYgS5jlPbgHcx)n2*+!+VcGlYh?;9Ngkg% z=MPD+`pXryN1T|%I7c?ZPLb3bqWr7 zU4bfG1y+?!bw)5Iq#8IqWN@G=Ru%Thxf)#=yL>^wZXSCC8we@>$hu=yrU;2=7>h;5 zvj_pYgKg2lKvNggl1ALnsz2IlcvL;q79buN5T3IhXuJvy@^crqWpB-5NOm{7UVfxmPJ>`?;Tn@qHzF+W!5W{8Z&ZAnDOquw6r4$bv*jM#5lc%3v|c~^ zdqo4LuxzkKhK4Q+JTK8tR_|i6O(x#N2N0Fy5)!_trK&cn9odQu#Vlh1K~7q|rE z61#!ZPZ+G&Y7hqmY;`{XeDbQexC2@oFWY)Nzg@lL3GeEVRxWQlx@0?Zt`PcP0iq@6 zLgc)p&s$;*K_;q0L(mQ8mKqOJSrq$aQYO-Hbssf3P=wC6CvTVHudzJH-Jgm&foBSy zx0=qu$w477lIHk);XhaUR!R-tQOZ;tjLXFH6;%0)8^IAc*MO>Q;J={We(0OHaogG0 zE_C@bXic&m?F7slFAB~x|n#>a^@u8lu;=!sqE*?vq zu4`(x!Jb4F#&3+jQ|ygldPjyYn#uCjNWR)%M3(L!?3C`miKT;~iv_)dll>Q6b+I&c zrlB04k&>mSYLR7-k{Od+lARt~3}Bv!LWY4>igJl!L5@;V21H6dNHIGr+qV551e@yL z`*SdKGPE^yF?FJ|`#L)RQ?LJ;8+={+|Cl<$*ZF@j^?$H%V;jqVqt#2B0yVr}Nry5R z5D?S9n+qB_yEqvdy9nFc+8WxK$XME$3ftSceLb+L(_id5MMc*hSrC;E1SaZYow%jh zPgo#1PKjE+1QB`Of|aNmX?}3TP;y6~0iN}TKi3b+yvGk;)X&i3mTnf9M zuv3qvhErosfZ%Pb-Q>|BEm5(j-RV6Zf^$icM=sC-5^6MnAvcE9xzH@FwnDeG0YU{J zi~Fq?=bi0;Ir=hfOJu8PxC)qjYW~cv^+74Hs#GmU%Cw6?3LUUHh|Yab`spoqh8F@_ zm4bCyiXPx-Cp4!JpI~w!ShPfJOXsy>f*|$@P8L8(oeh#~w z-2a4IOeckn6}_TQ+rgl_gLArS3|Ml(i<`*Lqv6rWh$(Z5ycTYD#Z*&-5mpa}a_zHt z6E`Ty-^L9RK-M*mN5AasoBhc|XWZ7=YRQSvG)3$v zgr&U_X`Ny0)IOZtX}e$wNUzTpD%iF7Rgf?nWoG2J@PsS-qK4OD!kJ?UfO+1|F*|Bo z1KU`qDA^;$0*4mUJ#{EPOm7)t#EdX=Yx1R2T&xlzzThfRC7eq@pX&%MO&2AZVO%zw zS;A{HtJiL=rfXDigS=NcWL-s>Rbv|=)7eDoOVnVI>DI_8x>{E>msC$kXsS}z?R6*x zi(yO`$WN)_F1$=18cbA^5|f`pZA+9DG_Zu8uW?rA9IxUXx^QCAp3Gk1MSdq zBZv;_$W>*-zLL)F>Vn`}ti1k!%6{Q=g!g1J*`KONL#)M{ZC*%QzsNRaL|uJcGB7jD zTbUe%T(_x`UtlM!Ntp&-qu!v|mPZGcJw$mdnanY3Uo>5{oiFOjDr!ZznKz}iWT#x& z?*#;H$`M0VC|a~1u_<(}WD>ogx(EvF6A6S8l0%9U<( zH||OBbh8Tnzz*#bV8&$d#AZNF$xF9F2{_B`^(zWNC}af(V~J+EZAbeC2%hjKz3V1C zj#%d%Gf(uyQ@0Y6CcP^CWkq`n+YR^W0`_qkDw333O<0FoO9()vP^!tZ{`0zsNQx~E zb&BcBU>GTP2svE2Tmd;~73mj!_*V8uL?ZLbx}{^l9+yvR5fas+w&0EpA?_g?i9@A$j*?LnmctPDQG|zJ`=EF}Vx8aMD^LrtMvpNIR*|RHA`ctK*sbG= zjN7Q)(|dGpC}$+nt~bupuKSyaiU}Ws{?Tha@$q}cJ;tvH>+MuPih+B4d$Zbq9$Y*U z)iA(-dK?Ov@uCDq48Zm%%t5uw1GrnxDm7*ITGCEF!2UjA`BqPRiUR`yNq^zz|A3wU zG(8DAnY-GW+PR2&7@In{Sla(XnMz5Rk^*5u4UvCiDQs@hvZXoiziv{6*i?fihVI|( zPrY8SOcOIh9-AzyJ*wF4hq%ojB&Abrf;4kX@^-p$mmhr}xxn#fVU?ydmD=21&S)s*v*^3E96(K1}J$6bi8pyUr-IU)p zcwa$&EAF$0Aj?4OYPcOwb-#qB=kCEDIV8%^0oa567_u6`9+XRhKaBup z2gwj*m#(}=5m24fBB#9cC?A$4CCBj7kanaYM&v754(b%Vl!gg&N)ZN_gO0mv(jM0# z>FC|FHi=FGlEt6Hk6H3!Yc|7+q{&t%(>3n#>#yx@*aS+bw)(2!WK#M0AUD~wID>yG z?&{p66jLvP1;!T7^^*_9F322wJB*O%TY2oek=sA%AUQT75VQ_iY9`H;ZNKFQELpZd z$~M`wm^Y>lZ8+F0_WCJ0T2td`bM+b`)h3YOV%&@o{C#|t&7haQfq#uJJP;81|2e+$ z|K#e~YTE87s+e0zCE2X$df`o$`8tQhmO?nqO?lOuTJ%GDv&-m_kP9X<5GCo1=?+LY z?!O^AUrRb~3F!k=H7Aae5W0V1{KlgH379eAPTwq=2+MlNcJ6NM+4ztXFTwI)g+)&Q7G4H%KH_(}1rq%+eIJ*3$?WwnZxPZ;EC=@`QS@|-I zyl+NYh&G>k%}GL}1;ap8buvF>x^yfR*d+4Vkg7S!aQ++_oNx6hLz6kKWi>pjWGO5k zlUZ45MbA=v(xf>Oeqhg8ctl56y{;uDG?A9Ga5aEzZB80BW6vo2Bz&O-}WAq>(PaV;*SX0=xXgI_SJ< zYR&5HyeY%IW}I>yKu^?W2$~S!pw?)wd4(#6;V|dVoa}13Oiz5Hs6zA zgICc;aoUt$>AjDmr0nCzeCReTuvdD1{NzD1wr*q@QqVW*Wi1zn;Yw1dSwLvTUwg#7 zpp~Czra7U~nSZZTjieZxiu~=}!xgV68(!UmQz@#w9#$0Vf@y%!{uN~w^~U_d_Aa&r zt2l>)H8-+gA;3xBk?ZV2Cq!L71;-tb%7A0FWziYwMT|#s_Ze_B>orZQWqDOZuT{|@ zX04D%y&8u@>bur&*<2??1KnaA7M%%gXV@C3YjipS4|cQH68OSYxC`P#ncvtB%gnEI z%fxRuH=d{L70?vHMi>~_lhJ@MC^u#H66=tx?8{HG;G2j$9@}ZDYUuTetwpvuqy}vW)kDmj^a|A%z(xs7yY2mU0#X2$un&MCirr|7 z%m?8+9aekm0x5hvBQ2J+>XeAdel$cy>J<6R3}*O^j{ObSk_Ucv$8a3_WPTd5I4HRT z(PKP5!{l*{lk_19@&{5C>TRV8_D~v*StN~Pm*(qRP+`1N12y{#w_fsXrtSt={0hJw zQ(PyWgA;;tBBDql#^2J(pnuv;fPn(H>^d<6BlI%00ylJZ?Evkh%=j2n+|VqTM~EUh zTx|IY)W;3{%x(O{X|$PS&x0?z#S2q-kW&G}7#D?p7!Q4V&NtA_DbF~v?cz6_l+t8e zoh1`dk;P-%$m(Ud?wnoZn0R=Ka$`tnZ|yQ-FN!?!9Wmb^b(R!s#b)oj9hs3$p%XX9DgQcZJE7B_dz0OEF6C zx|%jlqj0WG5K4`cVw!19doNY+(;SrR_txAlXxf#C`uz5H6#0D>SzG*t9!Fn|^8Z8; z1w$uiQzufUzvPCHXhGma>+O327SitsB1?Rn6|^F198AOx}! zfXg22Lm0x%=gRvXXx%WU2&R!p_{_1H^R`+fRO2LT%;He@yiekCz3%coJ=8+Xbc$mN zJ;J7*ED|yKWDK3CrD?v#VFj|l-cTgtn&lL`@;sMYaM1;d)VUHa1KSB5(I54sBErYp z>~4Jz41?Vt{`o7T`j=Se{-kgJBJG^MTJ}hT00H%U)pY-dy!M|6$v+-d(CkZH5wmo1 zc2RaU`p3_IJ^hf{g&c|^;)k3zXC0kF1>rUljSxd}Af$!@@R1fJWa4g5vF?S?8rg=Z z4_I!$dap>3l+o|fyYy(sX}f@Br4~%&&#Z~bEca!nMKV zgQSCVC!zw^j<61!7#T!RxC6KdoMNONcM5^Q;<#~K!Q?-#6SE16F*dZ;qv=`5 z(kF|n!QIVd*6BqRR8b8H>d~N@ab+1+{3dDVPVAo>{mAB#m&jX{usKkCg^a9Fef`tR z?M79j7hH*;iC$XM)#IVm&tUoDv!(#f=XsTA$)(ZE37!iu3Gkih5~^Vlx#<(M25gr@ zOkSw4{l}6xI(b0Gy#ywglot$GnF)P<FQt~9ge1>qp8Q^k;_Dm1X@Tc^{CwYb4v_ld}k5I$&u}avIDQ-D(_EP zhgdc{)5r_iTFiZ;Q)5Uq=U73lW%uYN=JLo#OS;B0B=;j>APk?|!t{f3grv0nv}Z%` zM%XJk^#R69iNm&*^0SV0s9&>cl1BroIw*t3R0()^ldAsq)kWcI=>~4!6fM#0!K%TS ziZH=H%7-f=#-2G_XmF$~Wl~Um%^9%AeNSk)*`RDl##y+s)$V`oDlnK@{y+#LNUJp1^(e89sed@BB z^W)sHm;A^9*RgQ;f(~MHK~bJRvzezWGr#@jYAlXIrCk_iiUfC_FBWyvKj2mBF=FI;9|?0_~=E<)qnjLg9k*Qd!_ zl}VuSJB%#M>`iZm*1U^SP1}rkkI};91IRpZw%Hb$tKmr6&H5~m?A7?+uFOSnf)j14 zJCYLOYdaRu>zO%5d+VeXa-Ai7{7Z}iTn%yyz7hsmo7E|{ z@+g9cBcI-MT~2f@WrY0dpaC=v{*lDPBDX}OXtJ|niu$xyit;tyX5N&3pgmCxq>7TP zcOb9%(TyvOSxtw%Y2+O&jg39&YuOtgzn`uk{INC}^Na_-V;63b#+*@NOBnU{lG5TS zbC+N-qt)u26lggGPcdrTn@m+m>bcrh?sG4b(BrtdIKq3W<%?WuQtEW0Z)#?c_Lzqj*DlZ zVUpEV3~mG#DN$I#JJp3xc8`9ex)1%Il7xKwrpJt)qtpq}DXqI=5~~N}N?0g*YwETZ z(NKJO5kzh?Os`BQ7HYaTl>sXVr!b8>(Wd&PU*3ivSn{;q`|@n*J~-3tbm;4WK>j3&}AEZ*`_!gJ3F4w~4{{PyLZklDqWo|X}D zbZU_{2E6^VTCg#+6yJt{QUhu}uMITs@sRwH0z5OqM>taO^(_+w1c ztQ?gvVPj<_F_=(ISaB~qML59HT;#c9x(;0vkCi2#Zp`;_r@+8QOV1Ey2RWm6{*J&9 zG(Dt$zF^7qYpo9Ne}ce5re^j|rvDo*DQ&1Be#Fvo#?m4mfFrNZb1#D4f`Lf(t_Fib zwxL3lx(Zp(XVRjo_ocElY#yS$LHb6yl;9;Ycm1|5y_praEcGUZxLhS%7?b&es2skI z9l!O)b%D=cXBa@v9;64f^Q9IV$xOkl;%cG6WLQ`_a7I`woHbEX&?6NJ9Yn&z+#^#! zc8;5=jt~Unn7!cQa$=a7xSp}zuz#Lc#Q3-e7*i`Xk5tx_+^M~!DlyBOwVEq3c(?`@ zZ_3qlTN{eHOwvNTCLOHjwg0%niFYm({LEfAieI+k;U2&uTD4J;Zg#s`k?lxyJN<$mK6>j?J4eOM@T*o?&l@LFG$Gs5f4R*p*V1RkTdCfv9KUfa< z{k;#JfA3XA5NQJziGd%DchDR*Dkld&t;6i9e2t7{hQPIG_uDXN1q0T;IFCmCcua-e z`o#=uS2_en206(TuB4g-!#=rziBTs%(-b1N%(Bl}ea#xKK9zzZGCo@<*i1ZoETjeC zJ)ll{$mpX7Eldxnjb1&cB6S=7v@EDCsmIOBWc$p^W*;C0i^Hc{q(_iaWtE{0qbLjxWlqBe%Y|A z>I|4)(5mx3VtwRBrano|P))JWybOHUyOY67zRst259tx;l(hbY@%Z`v8Pz^0Sw$?= zwSd^HLyL+$l&R+TDnbV_u+h{Z>n$)PMf*YGQ}1Df@Nr{#Gr+@|gKlnv?`s1rm^$1+ zic`WeKSH?{+E}0^#T<&@P;dFf;P5zCbuCOijADb}n^{k=>mBehDD6PtCrn5ZBhh2L zjF$TbzvnwT#AzGEG_Rg>W1NS{PxmL9Mf69*?YDeB*pK!&2PQ7!u6eJEHk5e(H~cnG zZQ?X_rtws!;Tod88j=aMaylLNJbgDoyzlBv0g{2VYRXObL=pn!n8+s1s2uTwtZc

YH!Z*ZaR%>WTVy8-(^h5J^1%NZ$@&_ZQ)3AeHlhL~=X9=fKPzFbZ;~cS**=W-LF1 z5F82SZ zG8QZAet|10U*jK*GVOA(iULStsUDMjhT$g5MRIc4b8)5q_a?ma-G+@xyNDk{pR*YH zjCXynm-fV`*;}%3=+zMj**wlCo6a{}*?;`*j%fU`t+3Korws%dsCXAANKkmVby*eJ z6`2%GB{+&`g2;snG`LM9S~>#^G|nZ|JMnWLgSmJ4!kB->uAEF0sVn6km@s=#_=d)y zzld%;gJY>ypQuE z!wgqqTSPxaUPoG%FQ()1hz(VHN@5sfnE68of>9BgGsQP|9$7j zGqN{nxZx4CD6ICwmXSv6&RD<-etQmbyTHIXn!Q+0{18=!p))>To8df$nCjycnW07Q zsma_}$tY#Xc&?#OK}-N`wPm)+2|&)9=9>YOXQYfaCI*cV1=TUl5({a@1wn#V?y0Yn z(3;3-@(QF|0PA}|w4hBWQbTItc$(^snj$36kz{pOx*f`l7V8`rZK}82pPRuy zxwE=~MlCwOLRC`y%q8SMh>3BUCjxLa;v{pFSdAc7m*7!}dtH`MuMLB)QC4B^Uh2_? zApl6z_VHU}=MAA9*g4v-P=7~3?Lu#ig)cRe90>@B?>})@X*+v&yT6FvUsO=p#n8p{ zFA6xNarPy0qJDO1BPBYk4~~LP0ykPV ztoz$i+QC%Ch%t}|i^(Rb9?$(@ijUc@w=3F1AM}OgFo1b89KzF6qJO~W52U_;R_MsB zfAC29BNUXpl!w&!dT^Zq<__Hr#w6q%qS1CJ#5Wrb*)2P1%h*DmZ?br)*)~$^TExX1 zL&{>xnM*sh=@IY)i?u5@;;k6+MLjx%m(qwDF3?K3p>-4c2fe(cIpKq#Lc~;#I#Wwz zywZ!^&|9#G7PM6tpgwA@3ev@Ev_w`ZZRs#VS4}<^>tfP*(uqLL65uSi9H!Gqd59C&=LSDo{;#@Isg3caF1X+4T}sL2B+Q zK*kO0?4F7%8mx3di$B~b&*t7y|{x%2BUg4kLFXt`FK;Vi(FIJ+!H zW;mjBrfZdNT>&dDfc4m$^f@k)mum{DioeYYJ|XKQynXl-IDs~1c(`w{*ih0-y_=t$ zaMDwAz>^CC;p*Iw+Hm}%6$GN49<(rembdFvb!ZyayLoqR*KBLc^OIA*t8CXur+_e0 z3`|y|!T>7+jdny7x@JHtV0CP1jI^)9){!s#{C>BcNc5#*hioZ>OfDv)&PAM!PTjS+ zy1gRZirf>YoGpgprd?M1k<;=SShCMn406J>>iRVnw9QxsR|_j5U{Ixr;X5n$ih+-=X0fo(Oga zB=uer9jc=mYY=tV-tAe@_d-{aj`oYS%CP@V3m6Y{)mZ5}b1wV<9{~$`qR9 zEzXo|ok?1fS?zneLA@_C(BAjE_Bv7Dl2s?=_?E9zO5R^TBg8Be~fpG?$9I; zDWLH9R9##?>ISN8s2^wj3B?qJxrSSlC6YB}Yee{D3Ex8@QFLZ&zPx-?0>;Cafcb-! zlGLr)wisd=C(F#4-0@~P-C&s%C}GvBhb^tTiL4Y_dsv@O;S56@?@t<)AXpqHx9V;3 zgB!NXwp`=%h9!L9dBn6R0M<~;(g*nvI`A@&K!B`CU3^FpRWvRi@Iom>LK!hEh8VjX z_dSw5nh-f#zIUDkKMq|BL+IO}HYJjMo=#_srx8cRAbu9bvr&WxggWvxbS_Ix|B}DE zk!*;&k#1BcinaD-w#E+PR_k8I_YOYNkoxw5!g&3WKx4{_Y6T&EV>NrnN9W*@OH+niSC0nd z#x*dm=f2Zm?6qhY3}Kurxl@}d(~ z<}?Mw+>%y3T{!i3d1%ig*`oIYK|Vi@8Z~*vxY%Od-N0+xqtJ*KGrqo*9GQ14WluUn z+%c+og=f0s6Mcf%r1Be#e}&>1n!!ZxnWZ`7@F9ymfVkuFL;m6M5t%6OrnK#*lofS{ z=2;WPobvGCu{(gy8|Mn(9}NV99Feps6r*6s&bg(5aNw$eE ztbYsrm0yS`UIJ?Kv-EpZT#76g76*hVNg)L#Hr7Q@L4sqHI;+q5P&H{GBo1$PYkr@z zFeVdcS?N1klRoBt4>fMnygNrDL!3e)k3`TXoa3#F#0SFP(Xx^cc)#e2+&z9F=6{qk z%33-*f6=+W@baq){!d_;ouVthV1PREX^ykCjD|%WUMnNA2GbA#329aEihLk~0!!}k z)SIEXz(;0lemIO{|JdO{6d|-9LePs~$}6vZ>`xYCD(ODG;OuwOe3jeN;|G$~ml%r* z%{@<9qDf8Vsw581v9y+)I4&te!6ZDJMYrQ*g4_xj!~pUu#er`@_bJ34Ioez)^055M$)LfC|i*2*3E zLB<`5*H#&~R*VLYlNMCXl~=9%o0IYJ$bY+|m-0OJ-}6c@3m<~C;;S~#@j-p?DBdr<><3Y92rW-kc2C$zhqwyq09;dc5;BAR#PPpZxqo-@e_s9*O`?w5 zMnLUs(2c-zw9Pl!2c#+9lFpmTR>P;SA#Id;+fo|g{*n&gLi}7`K)(=tcK|?qR4qNT z%aEsSCL0j9DN$j8g(a+{Z-qPMG&O)H0Y9!c*d?aN0tC&GqC+`%(IFY$ll~!_%<2pX zuD`w_l)*LTG%Qq3ZSDE)#dt-xp<+n=3&lPPzo}r2u~>f8)mbcdN6*r)_AaTYq%Scv zEdwzZw&6Ls8S~RTvMEfX{t@L4PtDi{o;|LyG>rc~Um3;x)rOOGL^Bmp0$TbvPgnwE zJEmZ>ktIfiJzdW5i{OSWZuQWd13tz#czek~&*?iZkVlLkgxyiy^M~|JH(?IB-*o6% zZT8+svJzcVjcE0UEkL_5$kNmdrkOl3-`eO#TwpTnj?xB}AlV2`ks_Ua9(sJ+ok|%b z=2n2rgF}hvVRHJLA@9TK4h#pLzw?A8u31&qbr~KA9;CS7aRf$^f1BZ5fsH2W8z}FU zC}Yq76IR%%g|4aNF9BLx6!^RMhv|JYtoZW&!7uOskGSGL+}_>L$@Jg2Vzugq-NJW7 zzD$7QK7cftU1z*Fxd@}wcK$n6mje}=C|W)tm?*V<<{;?8V9hdoi2NRm#~v^#bhwlc z5J5{cSRAUztxc6NH>Nwm4yR{(T>0x9%%VeU&<&n6^vFvZ{>V3RYJ_kC9zN(M(` zp?1PHN>f!-aLgvsbIp*oTZv4yWsXM2Q=C}>t7V(iX*N8{aoWphUJ^(n3k`pncUt&` ze+sYjo)>>=I?>X}1B*ZrxYu`|WD0J&RIb~ zPA_~u)?&`}JPwc1tu=OlKlJ3f!9HXa)KMb|2%^~;)fL>ZtycHQg`j1Vd^nu^XexYkcae@su zOhxk8ws&Eid_KAm_<}65zbgGNzwshR#yv&rQ8Ae<9;S^S}Dsk zubzo?l{0koX8~q*{uA%)wqy*Vqh4>_Os7PPh-maB1|eT-4 zK>*v3q}TBk1QlOF!113XOn(Kzzb5o4Dz@?q3aEb9%X5m{xV6yT{;*rnLCoI~BO&SM zXf=CHLI>kaSsRP2B{z_MgbD;R_yLnd>^1g`l;uXBw7|)+Q_<_rO!!VaU-O+j`u%zO z1>-N8OlHDJlAqi2#z@2yM|Dsc$(nc>%ZpuR&>}r(i^+qO+sKfg(Ggj9vL%hB6 zJ$8an-DbmKBK6u6oG7&-c0&QD#?JuDYKvL5pWXG{ztpq3BWF)e|7aF-(91xvKt047 zvR{G@KVKz$0qPNXK*gt*%qL-boz-*E;7LJXSyj3f$7;%5wj)2p8gvX}9o_u}A*Q|7 z)hjs?k`8EOxv1zahjg2PQDz5pYF3*Cr{%iUW3J+JU3P+l?n%CwV;`noa#3l@vd#6N zc#KD2J;5(Wd1BP)`!IM;L|(d9m*L8QP|M7W#S7SUF3O$GFnWvSZOwC_Aq~5!=1X+s z6;_M++j0F|x;HU6kufX-Ciy|du;T%2@hASD9(Z)OSVMsJg+=7SNTAjV<8MYN-zX5U zVp~|N&{|#Z)c6p?BEBBexg4Q((kcFwE`_U>ZQotiVrS-BAHKQLr87lpmwMCF_Co1M z`tQI{{7xotiN%Q~q{=Mj5*$!{aE4vi6aE$cyHJC@VvmemE4l_v1`b{)H4v7=l5+lm^ ztGs>1gnN(Vl+%VuwB+|4{bvdhCBRxGj3ady^ zLxL@AIA>h@eP|H41@b}u4R`s4yf9a2K!wGcGkzUe?!21Dk)%N6l+#MP&}B0%1Ar*~ zE^88}(mff~iKMPaF+UEp5xn(gavK(^9pvsUQT8V;v!iJt|7@&w+_va`(s_57#t?i6 zh$p!4?BzS9fZm+ui`276|I307lA-rKW$-y^lK#=>N|<-#?WPPNs86Iugsa&n{x%*2 zzL_%$#TmshCw&Yo$Ol?^|hy{=LYEUb|bMMY`n@#(~oegs-nF){0ppwee|b{ca)OXzS~01a%cg&^ zp;}mI0ir3zapNB)5%nF>Sd~gR1dBI!tDL z&m24z9sE%CEv*SZh1PT6+O`%|SG>x74(!d!2xNOt#C5@I6MnY%ij6rK3Y+%d7tr3&<^4XU-Npx{^`_e z9$-|@$t`}A`UqS&T?cd@-+-#V7n7tiZU!)tD8cFo4Sz=u65?f#7Yj}MDFu#RH_GUQ z{_-pKVEMAQ7ljrJ5Wxg4*0;h~vPUI+Ce(?={CTI&(RyX&GVY4XHs>Asxcp%B+Y9rK z5L$q94t+r3=M*~seA3BO$<0%^iaEb2K=c7((dIW$ggxdvnC$_gq~UWy?wljgA0Dwd`ZsyqOC>)UCn-qU5@~!f znAWKSZeKRaq#L$3W21fDCMXS;$X(C*YgL7zi8E|grQg%Jq8>YTqC#2~ys%Wnxu&;ZG<`uZ1L<53jf2yxYR3f0>a;%=$SYI@zUE*g7f)a{QH^<3F?%({Gg)yx^zsdJ3^J2 z#(!C3qmwx77*3#3asBA(jsL`86|OLB)j?`0hQIh>v;c2A@|$Yg>*f+iMatg8w#SmM z<;Y?!$L--h9vH+DL|Wr3lnfggMk*kyGH^8P48or4m%K^H-v~`cBteWvnN9port02u zF;120HE2WUDi@8?&Oha6$sB20(XPd3LhaT~dRR2_+)INDTPUQ9(-370t6a!rLKHkIA`#d-#WUcqK%pMcTs6iS2nD?hln+F-cQPUtTz2bZ zq+K`wtc1;ex_iz9?S4)>Fkb~bj0^VV?|`qe7W02H)BiibE9=_N8=(5hQK7;(`v7E5Mi3o? z>J_)L`z(m(27_&+89P?DU|6f9J*~Ih#6FWawk`HU1bPWfdF?02aY!YSo_!v$`&W znzH~kY)ll^F07=UNo|h;ZG2aJ<5W~o7?*${(XZ9zP0tTCg5h-dNPIM=*x@KO>a|Bk zO13Cbnbn7+_Kj=EEMJh4{DW<))H!3)vcn?_%WgRy=FpIkVW>NuV`knP`VjT78dqzT z>~ay~f!F?`key$EWbp$+w$8gR1RHR}>wA8|l9rl7jsT+>sQLqs{aITUW{US&p{Y)O zRojdm|7yoA_U+`FkQkS?$4$uf&S52kOuUaJT9lP@LEqjKDM)iqp9aKNlkpMyJ76eb zAa%9G{YUTXa4c|UE>?CCv(x1X3ebjXuL&9Dun1WTlw@Wltn3zTareM)uOKs$5>0tR zDA~&tM~J~-YXA<)&H(ud)JyFm+d<97d8WBr+H?6Jn&^Ib0<{6ov- ze@q`#Y%KpD?(k{if5-M(fO3PpK{Wjqh)7h+ojH ztb=h&vmy0tn$eA8_368TlF^DKg>BeFtU%3|k~3lZAp(C$&Qjo9lR<#rK{nVn$)r*y z#58_+t=UJm7tp|@#7}6M*o;vn7wM?8Srtc z3ZFlKRDYc^HqI!O9Z*OZZ8yo-3ie9i8C%KDYCfE?`rjrf(b&xBXub!54yaZY2hFi2w2asEOiO8;Hru4~KsqQZMrs+OhO8WMX zFN0=EvME`WfQ85bmsnPFp|RU;GP^&Ik#HV(iR1B}8apb9W9)Nv#LwpED~%w67o;r! zVzm@zGjsl)loBy6p>F(G+#*b|7BzZbV#E0Pi`02uAC}D%6d12TzOD19-9bhZZT*GS zqY|zxCTWn+8*JlL3QH&eLZ}incJzgX>>i1dhff}DJ=qL{d?yv@k33UhC!}#hC#31H zOTNv5e*ozksj`4q5H+75O70w4PoA3B5Ea*iGSqA=v)}LifPOuD$ss*^W}=9kq4qqd z6dqHmy_IGzq?j;UzFJ*gI5)6qLqdUL;G&E*;lnAS+ZV1nO%OdoXqw(I+*2-nuWjwM-<|XD541^5&!u2 z1XflFJp(`^D|ZUECbaoqT5$#MJ=c23KYpBjGknPZ7boYRxpuaO`!D6C_Al?T$<47T zFd@QT%860pwLnUwer$BspTO9l1H`fknMR|GC?@1Wn`HscOe4mf{KbVio zahne0&hJd0UL#{Xyz=&h@oc>E4r*T|PHuNtK6D279q!2amh%r#@HjaN_LT4j>{&2I z?07K#*aaZ?lNT6<8o85cjZoT~?=J&Xd35I%JJom{P=jj?HQ5yfvIR8bd~#7P^m%B-szS{v<)7i?#at=WA+}?r zwMlc-iZv$GT};AP4k2nL70=Q-(+L_CYUN{V?dnvG-Av+%)JxfwF4-r^Z$BTwbT!Jh zG0YXK4e8t`3~){5Qf6U(Ha0WKCKl^zlqhqHj~F}DoPV#yHqLu+ZWlv2zH29J6}4amZ3+-WZkR7(m{qEG%%57G!Yf&!Gu~FDeSYmNEkhi5nw@#6=Bt& zOKT!UWVY-FFyq1u2c~BJ4F`39K7Vw!1U;aKZw)2U8hAb&7ho|FyEyP~D<31{_L>RrCU>eEk-0)TBt5sS5?;NwAdRzRj5qRSD?J6 ze9ueq%TA*pgwYflmo`=FnGj2r_u2!HkhE5ZbR_Xf=F2QW@QTLD5n4h(?xrbOwNp5` zXMEtm`m52{0^27@=9VLt&GI;nR9S)p(4e+bAO=e4E;qprIhhclMO&7^ThphY9HEko z#WfDFKKCcf%Bi^umN({q(avHrnTyPH{o=sXBOIltHE?Q65y_At<9DsN*xWP|Q=<|R z{JfV?B5dM9gsXTN%%j;xCp{UuHuYF;5=k|>Q=;q zU<3AEYawUG;=%!Igjp!FIAtJvoo!*J^+!oT%VI4{P=XlbYZl;Dc467Nr*3j zJtyn|g{onj!_vl)yv)Xv#}(r)@25OHW#|eN&q7_S4i2xPA<*uY9vU_R7f};uqRgVb zM%<_N3ys%M;#TU_tQa#6I1<+7Bc+f%mqHQ}A@(y^+Up5Q*W~bvS9(21FGQRCosvIX zhmsjD^OyOpae*TKs=O?(_YFjSkO`=CJIb*yJ)Pts1egl@dX6-YI1qb?AqGtIOir&u zyn>qxbJhhJi9SjK+$knTBy-A)$@EfzOj~@>s$M$|cT5V!#+|X`aLR_gGYmNuLMVH4 z(K_Tn;i+fR28M~qv4XWqRg~+18Xb?!sQ=Dy)oRa)Jkl{?pa?66h$YxD)C{F%EfZt| z^qWFB2S_M=Ryrj$a?D<|>-Qa5Y6RzJ$6Yp`FOy6p2lZSjk%$9guVsv$OOT*6V$%TH zMO}a=JR(1*u`MN8jTn|OD!84_h${A)_eFRoH7WTCCue9X73nbD282V`VzTH$ckVaC zalu%ek#pHxAx=0migDNXwcfbK3TwB7@T7wx2 zGV7rS+2g9eIT9>uWfao+lW2Qi9L^EBu#IZSYl0Q~A^KYbQKwNU(YO4Xa1XH_>ml1v z#qS;P!3Lt%2|U^=++T`A!;V-!I%upi?<#h~h!X`p7eP!{+2{7DM0$yxi9gBfm^W?M zD1c)%I7N>CG6250NW54T%HoCo^ud#`;flZg_4ciWuj4a884oWUYV(#VW`zO1T~m(_ zkayymAJI)NU9_0b6tX)GU+pQ3K9x=pZ-&{?07oeb1R7T4RjYYbfG^>3Y>=?dryJq& zw9VpqkvgVB?&aK}4@m78NQhTqZeF=zUtBkJoz8;6LO<4>wP7{UPEs1tP69;v919I5 zzCqXUhfi~FoK5niVU~hQqAksPsD@_|nwH4avOw67#fb@Z5_OS=$eP%*TrPU%HG<-A z`9)Y3*SAdfiqNTJ2eKj8B;ntdqa@U46)B+odlH)jW;U{A*0sg@z>-?;nN}I=z3nEE@Bf3kh1B zdqT{TWJvb#AT&01hNsBz8v(OwBJSu#9}A6Y!lv|`J#Z3uVK1G`0$J&OH{R?3YVfk% z9P3HGpo<1uy~VRCAe&|c4L!SR{~^0*TbVtqej3ARx(Okl5c>m~|H9ZwKVHc_tCe$hsqA`l&h7qPP5xBgtwu!; zzQyUD<6J!M5fsV-9P?C9P49qnXR+iXt#G_AS2N<6!HZ(eS`|-ndb|y!(0Y({2 z4aF~GO8bHM7s+wnhPz>sa!Z%|!qWk*DGr)azB}j6bLe#FQXV4aO>Eo7{v`0x=%5SY zy&{kY+VLXni6pPJYG_Sa*9hLy-s$79$zAhkF)r?9&?UaNGmY9F$uf>iJ~u@Q;sydU zQaN7B>4B*V;rtl^^pa3nFh$q*c&sx^Um}I)Z)R&oLEoWi3;Yv6za?;7m?fZe>#_mS z-EGInS^#UHdOzCaMRSLh7Mr0}&)WCuw$4&K^lx{;O+?Q1p5PD8znQ~srGrygJ?b~Q5hIPt?Wf2)N?&Dae4%GRcRKL(a-2koctrcvxSslXn-k9cYS|<-KJ#+$Wo>}yKKh*3Q zHsK(4-Jv!9R3*FKmN$Z#^aZcACGrlGjOe^#Z&DfPyS-1bT9OIX~-I-5lN6Y>M}dvivbs2BcbPcaNH%25-xMkT$>*soDJ) z27;};8oCYHSLF0VawZFn8^H;hIN=J457@eoI6s2P87QN6O`q8coa;PN$mRZ>2Vv+! zQj1}Tvp8?>yyd_U>dnhx%q~k*JR`HO=43mB?~xKAW9Z}Vh2b0<(T89%eZ z57kGs@{NUHM>|!+QtqI@vE8hp`IIGc`A9Y{p?c;@a!zJFmdaCJ;JmzOJ8)B1x{yZp zi!U{Wh-h+u6vj`2F+(F6gTv*cRX7MR z9@?>is`MSS1L#?PaW6BWEd#EX4+O1x6WdU~LZaQ^Quow~ybz*aAu{ZMrQ;yQ8g)-qh>x z^}@eFu1u7+3C0|hRMD1{MEn(JOmJ|wYHqGyn*xt-Y~J3j@nY56i)sgNjS4n@Q&p@@^>HQjzNaw#C9=TbwzDtiMr2a^}bX< zZE%HU^|CnS`WYVcs}D)+fP#bW0+Q#l#JC+!`OlhffKUCN8M-*CqS;VQX`If78$as0 z=$@^NFcDpTh~45heE63=x5nmP@4hBaFn(rmTY2Yj{S&k;{4W!0Nu9O5pK30}oxM7{ z>l4cKb~9D?N#u_AleD<~8XD@23sY^rt&fN%Q0L=Ti2bV#px`RhM$}h*Yg-iC4A+rI zV~@yY7!1}-@onsZ)@0tUM23cN-rXrZYWF#!V-&>vds8rP+w0t{?~Q zT^LN*lW==+_ifPb+-yMh9JhfcYiXo_zWa`ObRP9_En3P))Qyu0qPJ3*hiFSu>Vt-j z<*HWbiP2#BK@nt<g|pe3 zfBKS@i;ISkorx@cOIx9}p^d8Gis%$)))%ByVYU^KG#eE+j1p;^(Y1ndHnV&YuQZm~ zj;f+mf>0ru!N`)_p@Ls<& z`t+JDx7}R568Q|8`4A}G@t8Wc?SOXunyW5C-AWoB@P>r}uwFY*=?=!K@J(!t@#xOuPXhFS@FTf6-7|%k;nw2%Z+iHl219Ho1!bv(Ee0|ao!Rs%Jl0@3suGrOsb_@VM;(xzrf^Cbd;CK3b%a|ih-fG)`Rd00O74=sQYW~Ve z#fl!*(fo~SIQ5-Sl?1@o7-E*|SK|hoVEKzxeg!$KmQLSTN=5N`rYeh$AH&x}JMR+5dq|~FUy&Oj%QIy;HNr;V*7cQC+ka>LAwdU)?ubI@W z={eg%A&7D**SIj$cu=CN%vN^(_JeIHMUyejCrO%C3MhOcVL~Niu;8WYoN}YVhb+=- zR}M3p|H0`E2Id99y#03r`8$s0t*iD>`^7EPm1~guC)L~uW#O~>I85Q3Nj8(sG<@T| zL^e~XQt9O0AXQ^zkMdgzk5bdYttP~nf-<831zulL>>ghTFii$lg3^80t8Gb*x1w5| zN{kZuv`^8Fj=t(T*46M=S$6xY@0~AvWaGOYOBTl0?}KTkplmGn-*P(X=o-v^48OY} zi11-+Y}y)fdy_tI;*W(>#qzvgQZ52t!nrGsJEy!c86TKIN(n|!&ucCduG$XaIapI z{(Z9gZANsI={A=5Aorgq2H25Dd}H5@-5=j=s{f`%^>6b5qkm_2|3g>r-^amf=B_xV zXg*>aqxXZ6=VUI4$})ypDMy$IKkgJ;V>077T9o#OhpFhKtHP_4mnjS5QCgGe<;~Xe zt<2ZhL7?JL6Mi|U_w?;?@4OD@=4EB2op_s)N-ehm#7`zSU#7itU$#%^ncqjc`9HCG zfj;O1T+*oTkzRi-6NN`oS3w3$7ZB37L>PcN$C$L^qqHfiYO4_>0_qCw0r@FEMj=>}}%q_`d#pUT;c?=gI zqTGpiY4Z;Q(B~#hXIVBFbi#dO=cOdmOqD0|An?7nMdrm2^C>yw*dQ=#lf8)@DvXK; z$MXp}QZgnE!&L73x0LZX_bCdD4lRY$$^?9dt1RwCng{lIpbb%Ej%yOh{@76yEyb}K zXZy%^656Sk3BLKbalcc>Dt5iDzo^tj2!wnDL(X;urJfpkWrab!frFSC6Q7m zuoqN!(t=L&+Ov&~9mz(yEB`MK%RPXS>26Ww5(F;aZ zR@tPAw~=q2ioOiynxgBqE&3-R-@6yCo0*mE;#I^c!=g~HyyjGA6}|<(0EseKDTM4w z94YnCO^VYIUY@}x8kr;;El-cFHVO<$6;-UdmUB|J8R*Wf$a37gVgYT|w5^KkYe=(i zMkA$%7;^a*$V+}e%S~&*^^O;AX9NLt@cIPc*v!lKZ)(zahAsUj%PJot19ErFU=Uk( z9Hw;Lb`V+BzVpMu;TGB9}y~ff)^mbEmF?g{{7_0SR zPgp*n)l{?>7-Ji;eWG{ln$)Bro+UJAQo6W2-23d@SI=HiFV3hR2OUcAq_9q~ye)o@ zq8WZvhg`H(?1AUZ-NM%_Cuj}eb{4wOCnqs^E1G9U4HKjqaw@4dsXWP#$wx^}XPZ0F zywsJ0aJHA>AHc^q#nhQjD3!KDFT6FaDioJ#HsZU7Wo?8WH19TJ%OMDz$XH5J4Cjdt z@crE;#JNG`&1H8ekB(R4?QiiZ55kztsx}pQti}gG0&8`dP=d(8aCLOExd*Sw^WL`Q zHvZ(u`5A58h?+G&GVsA;pQNNPFI)U@O`#~RjaG(6Y<=gKT2?1 z*pCUGU)f??VlyP64P@uT`qh?L03ZQyLOBn?EKwH+IG{XvTh5|NldaSV_n~DK&F1aa znq~C_lCQHMfW6xib%a2m!h&%J)aXb{%-0!HCcW|kzaoSwPMhJ6$KL|F~Sx(tctbwfkgV;#KZlEmJN5&l5XF9eD;Kqb<| z>os)CqC^qF8$be|v;)LY{Gh@c0?a??k7M7&9CH+-B)t&T$xeSzCs30sf8O-+I#rq} z&kZj5&i>UyK9lDjI<*TLZ3USVwwpiE5x8<|{Db z3`HX3+Tt>1hg?+uY{^wC$|Tb7ud@3*Ub?=2xgztgv6OOz0G z-4VRyIChHfegUak^-)-P;VZY@FT64#xyo=+jG<48n2%wcx`ze6yd51(!NclmN=$*kY=#uu#>=yAU-u4I9Bt0n_6ta?&9jN+tM_5_3RH);I zxTN4n$EhvKH%TmOh5mq|?Cx$m>$Ed?H7hUEiRW^lnW+}ZoN#;}aAuy_n189qe1Juk z6;QeZ!gdMAEx4Na;{O*j$3F3e?FLAYuJ2iuMbWf8Ub6(nDo?zI5VNhN@ib6Yw_4P)GY^0M7TJwat z2S*2AcP}e0tibZ@k&htTD&yxT9QRG0CEq$;obfgV^&6YVX9B9|VJf`1aS_#Xk>DFo zwhk?~)>XlP5(u~UW0hP7dWZuCuN4QM24Td&j^7~)WQ6YeCg)njG*ri}tTcG-NxX}p zNB>kcxd5ipW@tN3=6r@Jgm#rgrK*dXA!gxy6fAvP7$)8)Vc~PPQ|`( zPy|bG1sUz958-!zW^j(8ILV%QC@x`~PDFczboZqWjvSU<9O3!TQ&xYi%?Y0AiVBLV z%R?#1L#G&xw*RZPsrwF?)B5+MSM(b$L;GLnRsSU!_$N;6pD97~H}`c>0F`&E_FCNE z_)Q*EA1%mOp`z>+h&aqlLKUD9*w?D>stDeBRdR*AS9)u;ABm7w1}eE|>YH>YtMyBR z^e%rPeZzBx_hj?zhJVNRM_PX(O9N#^ngmIJ0W@A)PRUV7#2D!#3vyd}ADuLry;jdn zSsTsHfQ@6`lH z^GWQf?ANJS>bBO-_obBL$Apvakhr1e5}l3axEgcNWRN$4S6ByH+viK#CnC1|6Xqj& z*_i7cullAJKy9GBAkIxUIzsmN=M|(4*WfBhePPHp?55xfF}yjeBld7+A7cQPX8PE-|Pe_xqboE;2AJb5ifrEfr86k&F0+y!r`-urW}OXSkfz2;E``UTrGSt^B)7&#RSLTQitk=mmPKUKP`uGQ4)vp_^$^U`2Jjq zeul!ptEpa%aJo0S(504oXPGdWM7dAA9=o9s4-{>z*pP zJ31L#|L?YR;^%+>YRJrLrFC=5vc;0{hcxDKF z!ntmgO>rVDaGmRpMI7-+mv(j~;s_LARvcpkXj|{GHu1c<1 zKI)#7RE~Dizu1lG>p-PcY2jX#)!oJlBA$LHnTUWX=lu``E)vhf9h4tYL-juZ`e|Kb z=F?C;Ou)h^cxB;M-8@$ZSH0jkVD>x-XS$ePV1vlU8&CG))4NgU(=XFH=Jb1IB7dBysS+94}Y>sjS(&YcJwhn zifzA|g$D5rW89vkJSv()I+Th4R&C$g-!CB30xkh%aw4po3$@DK2fW>}enE2YPt&{C~j}`>RYICK{ zYAPfZ&%`R}u6MYo<>d`^O#Q(dM{3>T^%J{Vu;lr#Utg4x9!Z9J%iXs(j+dn&SS1_2 zzxGtMnu^`d%K4Xq4Ms-ErG3_7n?c(3T!?rvyW=G<7_XKDv*ox`zN*^BVwUoqh{D7o zdEiq;Zp6}k_mCIAVTUcMdH|fo%L#qkN19X$%b1#Oko|u4!M*oRqdBa3z98{H#g=d%5X&D#NXhLh`nUjxi8@3oo(AgeItdJ zIrt9ieHI1GiwHiU4Cba-*nK@eHI4uj^LVmVIntU@Gwf^t6i3{;SfLMCs#L;s;P4s5oqd^}8Uil!NssP>?!K z07nAH>819U=^4H6l-Dhy`^Q6DV^}B9^aR0B%4AH=D&+dowt9N}zCK+xHnXb-tsKaV6kjf;Wdp#uIZ_QsI4ralE>MWP@%_5eN=MApv92( z09SSB#%eE|2atm9P~X2W2F-zJD+#{q9@1}L2fF|Lzu@1CAJq*d6gA8*Jjb;<+Asih zctE|7hdr5&b-hRhVe}PN z$0G{~;pz1yhkbwuLkfbvnX=<7?b(1PhxAmefKn$VS6Sv)t-UypwhEs3?*E=(pc%Dlul1V~OdWvdf z{WBX?lhfO_g$$X~hm^Bhl@U0t<|beYgT)2L_C(z@B^-63c9Ak2*Aa)iOMylfl|qyNQdO#yoJ?m2FOkhZ1ou@G%+^m z#!#(gTv8nx^34(HddDp|dcFl@&eh+&FFJc@^FL3fV2?u&9Wt|Yp3&MS)e+ez0g~Ys zY7d0n^)+ z0@K^GJTLN?XAV(0F6e>o>HCGJU5(8WsSFErs0FsO=O1u$=T~xx7HYK{7C>-IGB8U+ z&G^Vy>uY}Bq7HX-X`U^nNh+11GjG-)N1l_tG<^4Tu4+4X9KO9IrdH+eXGk|G6Tc(U zU~g7BoO!{elBk>;uN-`rGQP-7qIf9lQhj-=_~0Qyszu>s$s0FrJatSylv!ol&{29~ z7S4fv&-UBOF&cR@xpuW*{x9$R;c_ALt?{+dI&HoBKG-!EY{yE=>aWhlmNhHlCXc(B zuA-zI*?Z9ohO$i8s*SEIHzVvyEF$65b5m=H*fQ)hi*rX8 zKlPqjD*Ix1tPzfR_Z3bO^n32iQ#vhjWDwj6g@4S?_2GyjiGdZZRs3MLM zTfl0_Dsn=CvL`zRey?yi)&4TpF&skAi|)+`N-wrB_%I_Osi~)9`X+`Z^03whrnP7f z?T`*4Id`J@1x#T~L(h5^5z%Cok~U|&g&GpCF%E4sB#i3xAe>6>24%Kuu=)=HRS;Pu2wghgTFa zHqm#sa{7-~{w_039gH0vrOm&KPMiPmuPRpAQTm5fkPTZVT&9eKuu%Riu%-oMQl2X6 z{Bnx`3ro^Z$}rVzvUZsk9T)pX|4%sY+j0i)If_z-9;a^vr1YN>=D(I7PX){_JTJ&T zPS6~9iDT{TFPn}%H=QS!Tc$I9FPgI<0R7?Mu`{FTP~rRq(0ITmP1yrJdy|m;nWmDelF-V^y7*UEVvbxNv0sHR?Q=PVYRuZinR(;RjVAG zm&qlSYvaiIbVEqBwyDaJ8LVmiCi{6ESF4pO?U&7pk&CASm6vuB;n-RauPFzdr!C%1 z8pjdSUts7EbA4Kg(01zK!ZU<-|d zU&jWswHnSLIg&mTR;!=-=~z(#!UsXt%NJR|^teM8kG@8Qg_0^6Jqfn&(eENtP8D7K zvnll3Y%7yh1Ai~0+l6dAG|lEGe~Oa+3hO>K2}{ulO?Vf*R{o2feaRBolc;SJg)HXHn4qtzomq^EM zb)JygZ=_4@I_T=Xu$_;!Q`pv6l)4E%bV%37)RAba{sa4T*cs%C!zK?T8(cPTqE`bJ zrBWY`04q&+On`qH^KrAQT7SD2j@C>aH7E8=9U*VZPN-(x>2a++w7R$!sHH+wlze2X)<<=zC_JJvTdY7h&Jum?s?VRV)JU`T;vjdi7N-V)_QCBzI zcWqZT{RI4(lYU~W0N}tdOY@dYO8Rx5d7DF1Ba5*U7l$_Er$cO)R4dV zE#ss{Dl`s#!*MdLfGP>?q2@GSNboVP!9ZcHBZhQZ>TJ85(=-_i4jdX5A-|^UT}~W{CO^Lt4r;<1ps@s|K7A z90@6x1583&fobrg9-@p&`Gh+*&61N!$v2He2fi9pk9W2?6|)ng7Y~pJT3=g~DjTcYWjY9gtZ5hk*1Qf!y2$ot@0St$@r8|9^GMWEE>iB~etL zXYxn#Rvc`DV&y93@U$Z91md1qVtGY*M(=uCc}@STDOry@58JNx`bUH}EIb(n6I}i? zSYJOZ2>B6&Payu+@V!gxb;)_zh-{~qtgVwQ-V;vK7e0^Ag_$3+g+{xSVudVOY_p-R z$sXhpFSk7je2lk5)7Y2;Z847E1<;5?;z(I)55YFtgF!J;NT|eVi}q^*2sM}zyM{+s zD0phl+J>k1E7cZEGmP?1-3~RE;R$q(I5}m?MX8xi?6@0f#rD8Cjkpv1GmL5HVbTnM zAQ&4-rbkpdaoLp~?ZoW>^+t0t1t%GO2B;ZD4?{qeP+qsjOm{1%!oy1OfmX?_POQJ4 zGwvChl|uE;{zGoO?9B_m{c8p(-;_yq?b^jA({}iQG35?7H7`1cm`BGyfuq7z1s~T| zm88HpS{z54T{jxC=>kZ=Z#8G@uya3tt0$xST5V$-V<;6MA66VFg}`LLU8L=q3DmkU z)P^X8pg`ndMY*>gr{6~ur^Q@Z8LNQf*6wkP03K<|M*+cDc#XKZ`Z0$1FkI-IDRw#| za52W4MyHlDABs~AQu7Duebjgc}02W;1jgBx&I@TMDXU`LJutQ?@r%1z`W zlB8G-U$q37G1ob>Er8j0$q@OU3IwG#8HsvJM#)j=Y%~#zY`jaG%5;!(kY3*a^t>(qf6>I zpAJpF%;FQ?BhDSsVG27tQEG*CmWhl4)Ngp%}D?U0!nb1=)1M==^B)^$8Li$boCY$S4U;G^A!?24nSYHra{< zSNapX#G+0BTac|xh`w&}K!);$sA3ay%^a2f?+^*9Ev8ONilfwYUaDTMvhqz2Ue2<81uuB71 zAl|VEOy%GQ7zxAJ&;V^h6HOrAzF=q!s4x)Mdlmp{WWI=gZRk(;4)saI0cpWJw$2TJcyc2hWG=|v^1CAkKYp;s_QmU?A;Yj!VQ1m-ugzkaJA(wQ_ zah00eSuJg<5Nd#OWWE?|GrmWr+{-PpE_Dbqs&2`BI=<%ggbwK^8VcGiwC-6x`x|ZY z1&{Vj*XIF2$-2Lx?KC3UNRT z&=j7p1B(akO5G)SjxXOjEzujDS{s?%o*k{Ntu4*X z;2D|UsC@9Wwk5%)wzTrR`qJX!c1zDZXG>-Q<3Z)7@=8Y?HAlj_ZgbvOJ4hPlcH#Iw z!M-f`OSHF~R5U`p(3*JY=kgBZ{Gk;0;bqEu%A;P6uvlZ0;BAry`VUoN(*M9NJ z%CU2_w<0(mSOqG;LS4@`p(3*Z7jC|Khm5-i>FcYr87};_J9)XKlE}(|HSfnA(I3)I zfxNYZhs#E6k5W(z9TI2)qGY&++K@Z?bd;H%B@^!>e2Wi@gLk)wC)T93gTxdRPU7uh z)`$-m(G2I5AuK52aj!fMJR|d^H?0X~+4xSpw zqNRtq5r8hic*{eAwUT<=gI5uXLg)o5mg4XnO^T+Rd+{l)<$Aqp{+RxhNYuX^45W0k z5$t%+7R;dX$`s6CYQYcims>5bNt+k&l_t%C9D-6sYVm%Y8SRC#kgRh*%2kqMg2ewb zp_X*$NFU%#$PuQ@ULP>h9Xw`cJ>J-ma8lU`n*9PcWFpE%x0^}(DvOVe2jz@ z0^2QOi0~t!ov?jI{#bw~`Aj5ymQW@eruRg`ZNJ5IT5_5AHbQ?|C>_7rwREf2e2x&L zlV8xdOkp_*+wdaqE?6bmdrFfaGepcj=0AI<+c=Tg^WB9BhFx?SvwoVdTEm&zPy@Vs zPs2mVPiw1n_h?Xi6!+w)ypsFXXuM>gIY(J+1N6r!sJ{+r1%BzRF20!D;bN>L^?O8n z(5|x2p^Q6X`!pm3!MMFET5`nJXn>tK`fFAj5Eo&t6;F>TU_4G93YGyzvF2_fB& zfE8(dq?R@@&Wh8~%G~rDt1+e)96O5)by_%;G~Zv`TpmZ)vY@BkAan*zEy(s`*{-@U z;$WPjoNx~m?`6Z;^O=K3SBL3LrIxfU{&g)edERkPQZK!mVYU-zHuV0ENDq^e<-?^U zGyRcrPDZZw*wxK(1SPUR$0t0Wc^*u_gb*>qEOP102FX|`^U%n*7z=wM@pOmYa6Z=-)T%!{tAFELY2`dTl3$&w! z7sgKXCTU(h3+8)H#Qov19%85Xo+oQh?C-q0zaM_X2twSCz|j_u!te3J2zLV#Ut_q7 zl+5LGx#{I`(9FzE$0==km|?%m?g~HB#BSz2vHynf1x14mEX^~pej*dhzD|6gMgOJ_ z8F_<>&OIz;`NSqrel?HI-K(|ypxwz}NtX!CF3&T(CkuYOnKS&%lUSU44KsgS`L>!w zl{MoT4`t=+p8>@88)Ea%*hOIkxt#b4RfrwRMr91UF_Ic~kV;|+dRW0a8Vl725+gsvtHr5 z>?3fai&9NmU|3;-nAu8OB|<(-2Kfub4MX&1i}dDd=R~Dk=U-Vr=@&lfEIYU~xtHHO z4TKt=wze`qm=69lD)sOOkZ;$9=0B#*g@X6xPM-%zG*rCXkN%eRDEUp$gAaEd29t&T zRTAg##Sk+TAYaa(LyTD__zL3?Z+45^+1o}(&f<~lQ*-z7`Um^>v@PKqOunTE#OyKFY^q&L^fqZgplhXQ>P3?BMaq6%rO5hfsiln7TppJ z>nG9|2MmL|lShn4-yz0qH>+o;Fe`V!-e*R0M|q~31B=EC$(bQZTW^!PrHCPE4i|>e zyAFK!@P}u>@hqwf%<#uv*jen5xEL|v!VQEK!F`SIz_H8emZfn#Hg}}@SuqPv+gJ@- zf3a`DT_Q#)DnHv+XVXX`H}At zmQwW2K`t@(k%ULJrBe6ln9|W8+3B*pJ#-^9P?21%mOk(W1{t#h?|j0ZrRi_dwGh#*eBd?fy(UBXWqAt5I@L3=@QdaiK`B_NQ$ zLXzm{0#6zh2^M zfu>HFK^d`&v|x&xxa&M|pr))A4)gFw<_X@eN`B1X%C^a{$39fq`(mOG!~22h)DYut z(?MONP1>xp4@dIN^rxtMp&a^yeGc8gmcajyuXhgaB;3}vFCQFa!pTDht9ld9`&ql`2&(dwNl5FZqedD^BP zf5K1`(_&i7x-&rD=^zkFD87idQrk(Y?E;-j^DMCht`A8Qa5J-46@G_*Y3J+&l{$}*QCATEc9zuzaQGHR8B;y*>eWuv)E##?Ba3w= zZ|v(l{EB`XzD#|ncVm#Wy?#Nzm3bS1!FJ70e{DGe$EgNDg7<_ic^mJSh&Xc|aTwCrTv;XkW~UlS&G%KyLklCn}F^i(YP(f z{cqH%5q9ND_S;l$HRP$Q@`D=F*_1$CXIA5X@|V&Vir$NQ$vCx!b&LGCR<-2y)m%HI zxeeyQIjiWcf4uD9+FP+EJ`&$oJ%$R(#w~GjqP|aTQj#d(;l#rq$vcM&Y4ZQ_i{Kpx z?k2BtoKb?+1-EVmG^ne-W%8+y?i#J5N5g8f^qpH5(ZZp7$u+?I9GB+&MREX?TmVV$ zA}Ps=^CkD^sD9N;tNtN!a>@D^&940cTETu*DUZlJO*z7BBy`Rl;$-D@8$6PFq@tz0 z=_2JMmq-JRSvx`;!XM|kO!|DENI-5ke8WR*Zj#vy#Nf1;mW-{6>_sCO8?sVWOKDM| zR(iaZrBrzlRatUzp_Y|2nOXnY2G%WLGXCo9*)th_RnXvXV=q;WNAimI98!A54|$&OCCG%$4m{%E&o?S|Qx<4K~YGmM1CS!vZAzLN%d znbZsw6ql=XkiwSbNofNeA42q8#LH6Rk(u@z172O#6K>Sb{#`t#GUgpd{2;D(9@I_9 zwsY(6Go7RmOThs2rM3|Z#Vbs}CHPLgBK6gE8;XkJQDx~p5wJ?XkE(0<^hwnt6;$~R zXCAzMfK@`myzdkkpv*ZbarVwCi&{-O#rswrb-#x4zRkxfVCq;mJLic|*C92T?0CYv z)FCqY$xA(QZmggPocZqQj0Rc?=Afna`@fpSn)&nSqtI}?;cLphqEF3F9^OZfW9@HDunc^2{_H)1D9(O}4e zJMi_4(&$CD{Jf5&u|7#Iq*F~)l!8pAzNrX^<&wfEu~}Ipslzx=g^ff2?B9SnV=!$ zv&K0`hMN6BVIusHNX-lr`#K?OG1S*S4rCQaI3ea(!gCl7YjxJ3YQ)7-b&N*D8k><*x|47s3; z4f~WTWuk|Qd*d*DICV}Vb0YSzFZp5|%s4}@jvtTfm&`|(jNpajge zD}@CMaUBs+b?Yu6&c#18=TxzMCLE76#Dy=DLiq_a_knQX4Uxk$&@3ORoBFK_&a>`QKaWu^)Hzrqz{5)?h3B_`4AOn{fG9k zEwnjQb>8XRq!k?rmCd6E**1cY#b9yczN4mD%GLCeRk}{TmR1*!dTNzY;(f!B0yVuk zSjRyf;9i@2>bdGSZJ=FNrnxOExb075;gB z*7&YR|4ZraFO#45-4h%8z8U}jdt?83AmU3)Ln#m3GT!@hYdzqqDrkeHW zU#R`Z8RHq996HR=mC}SRGtsz07;-C-!n*ALpwwBe~loM)YqMH)Um$sH0RbTTzxFd)h1=-w5Yl3k|3nQ zZG>=_yZ7Lsn=b8_MZI+LSHLGYSSCc?ht~7cv#39>Moz6AS}5 zus?xge0PGdFd2FpXgIscWOyG}oxATgd$yl0Ugf_&J_vwt`)XWx!p*gE_cWU(tUTnz zQS}!bMxJyi3KWh^W9m zxLcy``V@EfJzYjK@$e7Yk=q!kL8cd3E-zpc*wwvGJ62O!V;N zFG7Y?sJ+^a%H1;rdDZRu2JmGn6<&ERKes=Pwx)GG-nt73&M78+>SOy!^#=gvLB)2H zjv!J0O`-zft|0Jv$3k5wScY)XB+9leZgR5%3~HtZA=bCg7=Dn+F}>2lf;!*1+vBtf z9jhmqlH=t5XW{0MC7Y~O7jaju&2`p!ZDLGlgnd~%+EJ%A#pIByi-+EOmoLVoK&ow8 zTDjB%0hxhiRv+O3c2*y00rMA=)s|3-ev7emcbT43#izku7dvaDXy1IMV0ahjB9yzi z9C9fN+I2Mzt1*{`a6B?+PdWHiJ5fH}rb2t>q)~3RfCxmyK^y5jN7Pn(9DFh61GO%p zuBErj=m|bDn_L8SINU)Z&@K*AgGz+SUYO_RUeJt=E0M+eh&kqK;%Y1psBNU<4-s9# ziHFr7QP6Ew=-2CdfA#Bf|EsctH;<&=Hsd>)Ma8NvHB$cpVY@}TV!UN}3?9o@CS5kw zx%nXo%y|r5`YOWoZi#hE(3+rNKLZ2g5^(%Z99nSVt$2TeU2zD%$Q(=$Y;%@QyT5Rq zRI#b><}zztscQaTiFbsu2+%O~sd`L+oKYy5nkF4Co6p88i0pmJN9In`zg*Q;&u#uK zj#>lsuWWH14-2iG z&4w{6QN8h$(MWPNu84w1m{Qg0I31ra?jdyea*I~Xk(+A5bz{x%7+IL}vFDUI-Rf{! zE^&Dau9QxA2~)M98b42(D6Q}2PUum0%g>B?JS?o~VrP+Go2&c-7hIf7(@o1*7k$zS zy@o5MEe8DoX$Ie(%SZByyf9Xf9n8xkoX}s6RiO1sg*kAV^6EAAz$>*x^OmIy!*?1k zG+UQ|aIWDEl%)#;k{>-(w9UE7oKM#2AvQud}sby=D7$l6{$}SE8O9WgHM_+ zJ?tHeu@Pi93{AuwVF^)N(B~0?#V*6z;zY)wtgqF7Nx7?YQdD^s+f8T0_;mFV9r<+C z4^NloIJIir%}ptEpDk!z`l+B z5h(k$0bO$VV(i$E@(ngVG^YAjdieHWwMrz6DvNGM*ydHGU#ZG{HG5YGTT&SIqub@) z=U)hR_)Q@#!jck+V`$X5itp9&PGiENo(yT5>4erS<|Rh#mbCA^aO2rw+~zR&2N6XP z5qAf^((HYO2QQQu2j9fSF)#rRAwpbp+o=X>au|J5^|S@(vqun`du;1_h-jxJU-%v| z_#Q!izX;$3%BBE8Exh3ojXC?$Rr6>dqXlxIGF?_uY^Z#INySnWam=5dV`v_un`=G*{f$51(G`PfGDBJNJfg1NRT2&6E^sG%z8wZyv|Yuj z%#)h~7jGEI^U&-1KvyxIbHt2%zb|fa(H0~Qwk7ED&KqA~VpFtQETD^AmmBo54RUhi z=^Xv>^3L^O8~HO`J_!mg4l1g?lLNL$*oc}}QDeh!w@;zex zHglJ-w>6cqx3_lvZ_R#`^19smw-*WwsavG~LZUP@suUGz;~@Cj9E@nbfdH{iqCg>! zD7hy1?>dr^ynOw|2(VHK-*e%fvU0AoKxsmReM7Uy{qqUVvrYc5Z#FK&Z*XwMNJ$TJ zW1T**U1Vfvq1411ol1R?nE)y%NpR?4lVjqZL`J}EWT0m7r>U{2BYRVVzAQamN#wiT zu*A`FGaD=fz|{ahqurK^jCapFS^2e>!6hSQTh87V=OjzVZ}ShM3vHX+5IY{f^_uFp zIpKBGq)ildb_?#fzJWy)MLn#ov|SvVOA&2|y;{s;Ym4#as?M^K}L_g zDkd`3GR+CuH0_$s*Lm6j)6@N;L7Vo@R=W3~a<#VxAmM&W33LiEioyyVpsrtMBbON+ zX^#%iKHM;ueExK@|t3fX`R+vO(C zucU#Xf>OjSH0Kd%521=Sz%5Y!O(ug(?gRH@K>IUayFU~ntx`Wdm27dB-2s@)J=jf_ zjI-o;hKnjQ|Lg~GKX!*OHB69xvuDU zuG-H48~inKa)^r539a{F)OS`*4GShX>%BR)LU~a-|6+sx&FYsrS1}_b)xSNOzH|Kv zq>+1-cSc0`99EsUz(XWcoRO)|shn>TqKoQBHE)w8i8K`*Xy6(ls%WN_#d}YC^)NJ; zzl8!Zduz^Gg8*f0tCWnLEzw6k5Fv!QWC1x4)3r}+x~@#O8_)0>lP-@3(kFwLl%%Mz(TpATVnL5Pl2Gahw45QXI~>Hrw))CcEs@PP?}4^zkM$ z@(?H6^`Jl?A=(&Ue;W0`*a8&fR7vde@^q^AzX^H#gd~96`Ay^_A%?;?@q@t7l7iGn zWms#2J|To4;o1?3g3L!K_chdtmbEg~>U>$5{WO@Ip~YE&H($(^X6y_OBuNHkd0wu= z4rXGy#-@vZ?>M<_gpE8+W-{#ZJeAfgE#yIDSS?M?K(oY@A|FaS3P;OjMNOG% zGWyZWS(}LJCPaGi9=5b%sq$i!6x@o(G}wwfpI5|yJe24d_V}cT1{^(Qe$KEMZ;>I@ zuE6ee%FLgem>CKEN8SeY)fpK#>*lGcH~71)T4p|9jWT;vwM@N!gL}nCW=Oi6+_>K2 zl4sWXeM1U}RETA~hp=o3tCk+?Zwl#*QA>Wwd|FlUF0)U;rEGPD1s0Syluo zfW9L(F>q9li8YKwKXZrp*t)N9E;?&Hdbm-AZp2BcDTHO6q=tzVkZsozEIXjIH`tm} zo2-UleNm*Lj7zgvhBph_|1IggkSuW~S(9ueZEfao8BuzqlF(a+pRivTv(Zb zXFaHwcuovdM#d+!rjV7F<^VW&@}=5|xj!OUF)s0zh|8yzC)7!9CZB+TLnycoGBsDF z$u&j={5c(4A$iik;x6_S96Krw8--+9pGY+*oSVTIuq;$z8*)W8B~rMX_(U6uM}!Gc`T;WfEKwI84%)-e7j}>NA(O_)3Vn9 zjXxY1Fnx3Fx%CFpUHVu0xjvxgZv}F9@!vC!lD|05#ew3eJ}@!V&urwRKH`1f{0e^o zWvM1S@NbI6pHdzm33pza_q;#?s%J*$4>10uYi4l%5qi|j5qh+D=oqSJR=7QwkQh>>c$|uJ#Z@lK6PMHs@ zyvnnoOSkGQkYz#g>||xN&1fV)aJb*y--Y`UQV~lt!u8yTUG59ns1l7u>CX2F>9fl; zB)zH3z^XHmSU{F_jlvESvaNL&nj^;j)29~1LcTYw>(6}>bt0hiRooqm0@qTj%A&P9 zKmexPwyXG@Rs1i+8>AJ;=?&7RHC7Mn%nO>@+l?Qj~+lD376O2rp)>tlVHn8MKq zwop1KRLhUjZ|+6ecGIAftSPT*3i94=QzYCi_ay+5J&O(%^IsqZ!$w-^bmd7ds$^!q z;AkC;5mTAU>l0S$6NSyG30Ej?KPq@#T)^x#x?@U~fl2m$Ffk)s6u|iPr!)-j0BlA7p3E*A|My8S#KH;8i-IQq7Q*F4*ZVPe<{^SWz_ zr?!6cS+@|C#-P~d#=W1n7acn8_pg#W-lcyf+41zwR+BU6`jUkP^`*wgX)FxEaXzoi z8)?FE*97Yqz|b@fR1(r{QD363t260rQ(F||dt9^xABi+{C*_HL9Zt5T;fq|#*b}=K zo5yj_cZB(oydMAL&X(W6yKf>ui?!%(HhiHJ83EA|#k0hQ!gpVd( zVSqRR&ado+v4BP9mzamKtSsV<|0U-Fe2HP5{{x&K>NxWLIT+D^7md{%>D1Z-5lwS~ z6Q<1`Hfc+0G{4-84o-6dr@)>5;oTt|P6jt9%a43^wGCslQtONH)7QXJEYa!c~39 zWJpTL@bMYhtem1de>svLvOUa*DL7+Ah0(_~2|ng`!Z!qiN}6xL;F}<%M8qWv&52-Y zG*1A&ZKlp~{UFV%Hb_*Re({93f7W*jJZMV-Yn|<+l3SPN+%GuPl=+tSZxxr%?6SEc zntb0~hcK691wwxlQz_jSY+V_h+0o`X!Vm{;qYK$n?6ib1G{q>a%UejzOfk6q<=8oM z6Izkn2%JA2E)aRZbel(M#gI45(Fo^O=F=W26RA8Qb0X;m(IPD{^Wd|Q;#jgBg}e( z+zY(c!4nxoIWAE4H*_ReTm|0crMv8#RLSDwAv<+|fsaqT)3}g=|0_CJgxKZo7MhUiYc8Dy7B~kohCQ$O6~l#1*#v4iWZ=7AoNuXkkVVrnARx?ZW^4-%1I8 zEdG1%?@|KmyQ}tploH>5@&8Cp{`)CxVQOss&x|Z7@gGL3=tCVNDG!N9`&;N$gu^MDk|`rRm=lhnXAJ5v1T)WTz)qvz|Dw zR?{}W4VB(O6#9%o9Z^kFZZV*PDTAWqkQ8TH!rti8QIcR&>zcg3qG}&A( zwH^K8=`1C1lRfhrX{IvNn9R9!$UMC%k(;;VH%`S0h_on|Gh6qDSH&#}*m-u{;p~WB zF$_I~xx!RxVrxNQdr@3T>{F#^D{@N9OYC9LsV62F_Z1KYQ5yk*C5WQ4&q}Kz(I{9UWWf?LIcCZicB1EO_FUH*a9QKS(4IR%#D5DTi_@M}Q_-4)J4d zz@!vR0}5MPAOK(#uL+$7XOcP$5SS#*EK9Rt6XN%}HB7@`8S^gNRk!HLv(CvCjX4o= z>9scPwWbE!F8T=@x9^;s-OF2!eO(!gL9$-AmzUiDnu&QS4If5ea2T070n1-IyNhck z9$J8b!he3@q5qB-cQ;5ymVIXXn46kK0sqKZV+3s3^mac=3~BrCW})WNrrRs1KtMmg zLzwXYC?@_H#s3W4D$W0rh%WL|G<1$$uYdptPbxy0ke!c%v#x9I=2?S)YVkg1X$W^cB!i>B{e9wXlm8AcCT8|verIZQngj>{%W%~W0J%N`Q($h z^u3}p|HyHk?(ls7?R`a&&-q@R<94fI30;ImG3jARzFz<(!K|o9@lqB@Va+on`X2G) zegCM8$vvJ$kUwXlM8df|r^GQXr~2q*Zepf&Mc%kgWGTf;=Wx%7e{&KId-{G}r22lI zmq%L6Y-M*T$xf8 z#kWOBg2TF1cwcd{<$B)AZmD%h-a6>j z%I=|#ir#iEkj3t4UhHy)cRB$3-K12y!qH^1Z%g*-t;RK z6%Mjb*?GGROZSHSRVY1Ip=U_V%(GNfjnUkhk>q%&h!xjFvh69W8Mzg)7?UM=8VHS* zx|)6Ew!>6-`!L+uS+f0xLQC^brt2b(8Y9|5j=2pxHHlbdSN*J1pz(#O%z*W-5WSf# z6EW5Nh&r<;$<3o1b013?U$#Y!jXY)*QiGFt|M58sO45TBGPiHl4PKqZhJ|VRX=AOO zsFz-=3$~g#t4Ji9c;GFS9L~}~bzgCqnYuJ-60AMDdN7HZt8_$~Of{oXaD3HVn9zkH z`>#xQNe=YpWTq_LcOoy}R`L<_4il7w4)QH4rl?AUk%?fH##I>`1_mnp&=$-%SutYT zs}sSNMWo;(a&D()U$~PG0MvZ#1lmsF&^P4l_oN#_NORD-GSmR{h_NbJ^ZdY#R9#qW zKAC%V*?y~}V1Zh#d|-z1Z8sy5A+}*cOq$xk@Pn&{QffzG-9ReyPeEhqF%~Z3@|r(s z3(wA&)dV~fELW*&*=!~l9M=7wq8xE(<@)BjjN8bUiS8@N9E{wi+Dd!V1AtT;Nl}9> zTz`2ge2Jn#Dlg1kC%oFlOe<>?jYC`Asr^%i4hH;S`*qZTPRan2a9Kjj=0aq{iVi2Z z87PZt$d(LAm_{92kl+2Z%k3KGV;~gsp;C>k?gMYZrVIzaI|0D+fka9G_4v>N96*8T zI(C8bj?A7l%V&U?H_IpSeCvf7@y1e?b>G7cN382GVO0qAMQ93(T*<*9c_;%P1}x2l zi8S$s<=e_8ww%DaBAf4oIQ7}U7_48$eYpo}Fb+F|K|43IAPR1y9xbqPPg6er{I7xj|=>-c%pGBRLn1~=5KbAb1mJAx=z(loN!w{49VkEthF>*OX z)=gqXyZB5%5lIWYPWh~{!5pSt43-)-@L@x=pmiuKP-3Cwq8qSxGNwaTT4->BWEjxk zUjr)z7WrBZB5u3iV>Y_>*i~*!vRYL)iAh5hMqNzVq1eeq=&d9Ye!26jks{f~6Ru&c zg$D;^4ui#kC`rSxx`fP!zZ^6&qSneQzZRq0F*V4QvKYKB<9FC%t#)Tik%Zq*G*IOW z3*`2!4d)!3oH>GxVcXlorJDt+JnH)p{~olYBPq|>_V@8=l#(f*diW=L+%>rfWCcPQ z#H^ksQt15Z5Uc4ODq8_JwD5^H&OGqyH6E@MabJQO>s`?bqgA6}J_QpytW{2jH#eCN z8k7y*TFZ2lj2B|1CB(@QZedFfPhX|IQbKMI;$YK>9Zla0fsU7}an6(kP;sXpBWLR` zJ#z_kk!`JJC7h(1J!+G)gL2WB2&0*~Q!%s??}GH?=`hU@03xOwU} z6s7?tGySLz!%(MwxQRiF)2(vR2wQX`YB}u&I-S+RR)LQcyH407#-{*pWLJJR?X|5 zsAl2k{&0N-?JArn@)9YTo-5+gl}R~XkbZM*5AOjPrcikpE3P?p0oN^?H+5+n)}Qxe z*RQ!-eu0RxPyF8B=}xnseNpQMXFU$d^=(G%kUd&|!BHSm7bXoGR$WA+%yjuA{|S>u z?9N6JDhS+ui~rd?wY_t7`p)|qKIMM>6jz%$jv4hc_YUDjF6-%5muq|SNuoji2)|qK zNY5+oWMe+5vu{I*grk6xlVk;(J)uuy13G`VDbj(~Vz9lA)_;$aj?=-cmd#h~N0mn{ z9EIS_d4C=L3H;Pl^;vcpb&-B+)8vt%#?gn5z>#;G{1L&8u8cXJYADMUsm9>%*%)&F zsi&I{Y=VUsV82+)hdNgDWh^M7^hMs|TA0M269^|RIGfdX1MetV2z`Ycb&_Mn4iRI! zeI6O}O9mOhN6pzfs5IfMz#Gxl`C{(111okA8M4gijgb~5s7QTyh84zUiZZ^sr1^ps z1GO`$eOS@k@XP^OVH|8)n}Wx)fKHoGwL&5;W?qEf5Jdsd!3hf7L`%QNwN0gGBm^2= z@WI+qJMJG1w2AS9d@Dt$sj_P$+S2kh7+M72^SfcdBjQEtWQ5?PT&a~G9hOo6CtS>h zoghqoR;sk{X)`ZK-M|lu{M}0>Mrs^ZW@ngC?c$26_vYKDBK^n7sFiod_xV#XcPL!^ zRPyqD{w^9u{oA3y73IW0 zH;%xop$r(Q=bq=JaLT%myEKD_2&?L@s6TzsUwE#g^OkiU6{lN)(7I?%a;_%r5_^@d zS-Z)Q-2o|~?F~f`sHlhNhiZk;!CW;3Ma6{xPlBjJx8PXc!Oq{uTo$p*tyH~ka`g<` z;3?wLhLg5pfL)2bYZTd)jP%f+N7|vIi?c491#Kv57sE3fQh(ScM?+ucH2M>9Rqj?H zY^d!KezBk6rQ|p{^RNn2dRt(9)VN_j#O!3TV`AGl-@jbbBAW$!3S$LXS0xNMr}S%f z%K9x%MRp(D2uO90(0||EOzFc6DaLm((mCe9Hy2 z-59y8V)5(K^{B0>YZUyNaQD5$3q41j-eX))x+REv|TIckJ+g#DstadNn_l~%*RBSss_jV3XS&>yNBc8H2jo(lwcLz-PuYp< z7>)~}zl$Ts0+RFxnYj7-UMpmFcw_H zYrsXM>8icD)@Iauiu_(Y#~Iyl)|pj@kHkWvg2N$kGG(W>Y)nfNn%z2xvTLwk1O2GQ zb^5KAW?c%5;VM4RWBy}`JVCBFOGQWoA9|+bgn7^fY3tSk1MSZccs9&Fy6{8F>_K@? zK(z=zgmq1R#jGE^eGV`<`>SP9SEBx!_-Ao|VZq6)-rUpd^<2GgVN&uHiM{0zA9kI( z<1^1%*uE$?4mXV@?W8}fvnBOpfwCo^?(a0E402!pZi&Kd5pp$oV%2Ofx<}YC-1mynB3X|BzWC_ufrmaH1F&VrU&Gs+5>uixj*OJ*f=gs9VR8k^7HRR$Ns|DYBc*Slz>hGK5B1}U+}#j0{ohGC zE80>WClD5FP+nUS?1qa}ENOPb2`P4ccI<9j;k?hqEe|^#jE4gguHYz-$_BCovNqIb zMUrsU;Fq%n$Ku_wB{Ny>%(B&x9$pr=Anti@#U%DgKX|HzC^=21<5Fn6EKc#~g!Mcj zJrI(gW+aK+3BWVFPWEF*ntHX5;aabHqRgU-Nr2t++%JRPP7-6$XS|M8o&YSgf3a9A zLW*tSJxoe1?#T4EocApa*+1kUIgy7oA%Ig9n@)AdY%)p_FWgF-Kxx{6vta)2X1O5y z#+%KQlxETmcIz@64y`mrSk2Z17~}k1n{=>d#$AVMbp>_60Jc&$ILCg-DTN~kM8)#o$M#Fk~<10{bQ>_@gU2uZE z*eN~mqqQC*wh{CI(!xvRQ^{jyUcvE~8N)S0bMA^SK@v;b7|xUOi63X~3Qc>2UNSD1) z7moi9K3QN_iW5KmKH>1ijU41PO>BvA6f1;kL)6io%^r>?YQ#+bB;)Rzad5;{XAJGeAT#FnDV0$w2>v|JeFIB zZ>8vmz?WVs78PuCDiHfb@D0Yi;2#%){*#?bY4dpta6dSjquGLcOw?Z{nxg98mN^4* zj&^!WMUQ_zFp+}B|G0vcNsk8(2u9(LAPk5ogKt%zgQ4^1#UCd;`-W#X8v{YyQ_m9g z8`jydw>>@1J{Q*q#5^cHVA~xR9LR3Hl@^bx)`IBKmj+Gmye36;xwL0>sS|mV+$~%b zC;2wEm&Ht3#6P|2Y0XQ+5t-aI)jn{o%&ZHWvjzEtSojFgXxNKO^e(RmM`gsJ4GrR8 zKhBtBoRjnH`mD$kT;-8ttq|iw?*`7iTF_AX<^Qe3=h8L^tqz$w$#Z@Z$`C579Jeeu ztr0z~HEazU&htfG@`HW!201!N(70hCd{%~@Wv)G*uKnJZ8>hFx`9LnYs;T>8p!`5T zx#aXXU?}B{QTV_Ux(EMzDhl-a^y^f5tRU;xnOQoN)pThr4M>-HU)As8nQ34-0*sab&z<2ye-D_3m&Q`KJJ|ZEZbaDrE%j>yQ(LM#N845j zNYrP)@)md;&r5|;JA?<~l^<=F1VRGFM93c=6@MJ`tDO_7E7Ru zW{ShCijJ?yHl63Go)-YlOW2n3W*x%w||iw(Cy>@dBJHdQl){bBVg{wmRt{#oXb9kaWqe{bJPmGE$$ z_0=cmD9dVzh<8&oyM8rK9F^bufW$Bj2cFhw&f*oKKyu$H{PI=Aqe^NL6B=dkMEAk& zE3y&F=x;e|!7kMn%(UX>G!OE$Y$@UyME#d;#d+WLmm@W@y!sboiIox^DZPB|EN<>7 z57xm5YWlFUGyF|{<*;b&Cqm+|DC8{rB9R@2EFHGL^NX*l#AcDpw6}bCmhY7!(Gv{s zm^eYNvzyJLQA#GhmL*oSt^Uulb5&ZYBuGJTC>Vm9yGaZ=Vd--pMUoDRaV_^3hE9b*Pby#Ubl65U!VBm7sV}coY)m zn1Ag^jPPLT93J{wpK%>8TnkNp;=a@;`sA7{Q}JmmS1bEK5=d@hQEWl;k$9M-PYX~S zayGm;P(Wwk23}JR7XM~kNqba`6!Z+Wt2|5K>g_j3ajhR>+;HF?88GBN!P; zr6sQ8YYpn%r^gbi8yYK7qx6U5^Tf<|VfcR$jCo`$VMVh_&(9w@O?|o3eRHq*e*#P z8-==G)D?vB3Zo~b-dkx8lg0^=gn`9FUy?ZzAfWQd>>@cyqF!sHQ_S&@$r&tTB~Lxq zAjAZTK~?J{A|L3)8K>S{`Qf%131B>?<~t=w!D{;olQ>#31R#{go`a9DOy+H*q5t+; z^*Ka!r@#8tk?~tQbylaG-$n#wP2VzIm3vjrZjcmTL zl`{6mhBhMKbSWoGqi;g3z1@G0q!ib`(Zz_o8HG_*vr8U5G|vhZn26h`f~bO&)RY0; zw(CWk*a_{ji_=O9U}66lI` zCm32)SEcAo5)5k>{<8DLI@Zz)*R29BB!^wF;WZRF9sAi39BGObmZzg?$lUn6w1rYPHSB^L4^AN zLObEaUh7TXpt6)hWck#6AZV(2`lze<`urGFre|>LUF+j5;9z%=K@&BPXCM)P$>;Xc z!tRA4j0grcS%E!urO^lsH-Ey*XY4m&9lK(;gJOyKk*#l!y7$BaBC)xHc|3i~e^bpR zz5E-=BX_5n8|<6hLj(W67{mWk@Bfc){NGAX z5-O3SP^38wjh6dCEDLB#0((3`g4rl}@I(&E8V2yDB=wYhSxlxB4&!sRy>NTh#cVvv z=HyRrf9dVK&3lyXel+#=R6^hf`;lF$COPUYG)Bq4`#>p z@u%=$28dn8+?|u94l6)-ay7Z!8l*6?m}*!>#KuZ1rF??R@Zd zrRXSfn3}tyD+Z0WOeFnKEZi^!az>x zDgDtgv>Hk-xS~pZRq`cTQD(f=kMx3Mfm2AVxtR(u^#Ndd6xli@n1(c6QUgznNTseV z_AV-qpfQ0#ZIFIccG-|a+&{gSAgtYJ{5g!ane(6mLAs5z?>ajC?=-`a5p8%b*r*mOk}?)zMfus$+W~k z{Tmz9p5$wsX1@q`aNMukq-jREu;;A6?LA(kpRut+jX?Tt?}4HGQr}7>+8z4miohO2 zU4fQ?Y8ggl%cj&>+M+)TTjn8(?^%`~!oAt#ri8gIbzIig$y#d7o##077fM9sCu%N9 zOIsq4vyox6`itu*j{eOD<$gTZd-$JuyM^cM>{?v<8# zS1yN%R0zRy&>+D*Gv-&S80?JF+Y|c^^IJWDnfy06MI2{NFO-x4JXsb@3Qp;EnL!a{ zJwKwV@mO zYVGvNmeJ!;+ce+@j@oo-+`DaPJX|h@7@4BD`QEdP?NKkYzdIa3KrZt%VUSsR+{b+| zk?dSd#9NnVl?&Y$A{-OtZ>wk%mWVF5)bf`)AA2{EFapIS4jil69Xan>*J^6Juou&`oJx|7-&|@8z?$ z2V#jm!UHstCE*qM{OGtqYY8q+x%SL6&aGY!a>@d=_G~^0;+7dY9P`oJ*)67*9Kx*O zKitC5V3g5;&L-fa37?eN=;V_c^L-ph_uKv5)Q`&!Z!RPlDWA2{J%a2q@_*?-cn@bH zIt)+mA@HaJj2RV+-MNc#y#Vji*N~m!ZyrYyg-7UK4PYK4F7Y$3Y%@Lk6iPp=I96N> z!;ih(KtZMB23*v{`5cJ}^4D*P!k1&OfU&1%borv_q|7jfaV7fL+wwx8Zp*b}B_O>NRSeJeM zpvw3M`=vSYjFYQ11kx1xqOnJ@degPh&SyXnWz-l719EiW17Yo?c~Bh~;R$MOl+jzV zM1yTq-1**x-=AVR;p0;IPi`#=E!G5qIT>EFE`Bn<7o*8!aVd7?(CZT=U9^Gi3rmWUQG z0|GaP9s$^4t_oLCs!fInyCoB(d?=tZ%%Bb2Y+X&7gvQ6~C4kU%e$W_H;-%XSM;&*HYYnLI z>%{5x_RtSUC~PI4C0H^>O%FixKYVubA>#72wexd}Cgwuw5ZYTvcN2ywVP(dO=5975 zCjo)mOa2Bo&ucEsaq8wi1{h*brT(H=XrTOy*P>?0%VV1QDr09X+Je!T)JT`02?gjX zT@B8}h|;4lH35Guq2gKZT?ags-~Ts~S=poPnQ_T1*?U|{$jaur_PjQ6WmF_(XLFG)d#|iiBC=&B zp}1eOQvQ!3UpL?K`=8hAzMkv#a^COr`J8i}d!BPX&*xp-LL#qse~mOtxI-}{yPRNV zJNTL1{7A55F~K>0e&Os%MwQ~?n1>QV=j!8o_`^-&*E|Q-L9DNr%#6sw8kQVE3E|*}$aAoO$@27ei1w=+zU%?AA!;mf#!%IV*w_D=u516!Kz1F0-WnyVB`I6F1Pc3r1=0iT<_(pCyk>@22z1$w$@M>7AIuk6+ zRG&MFVQ_7>5DLoR5HeOa$?2SA(v2u!#8;5I(ss%=x9U#R zU62n~&)22RTTsp${}6C&$+l&0skFVX%ACgc$(iQ#DVRRz!`Y+b>E?;ib(TH#6Wa=} zs(q_;SA|fhyEo7Ix%rAY9j=Ul^Rzd`3ABf+yO@~h@Rh=wo`?;8PdHE1AUo34r7izy znAr`;VavQueSu7bD5r^nXTERcW(P-{2SOSfF1x0cW1Nczvj0}@!!upORN1%_-b2bh zGt#zokJz&SveJRzlUK4DruxR(YuHEAmB%F}buU`*pAzJ7Mbgs4sg;H@&6x*wxvGm6 z>KH@ilsvvdl@CGfm4T+$agodrB=md8ygG!|O=r@FY>S_zX%*)mqf?XBX*chhQ9uPP z-(T(24)})vWD*{bQM5_hy3CD8C>anuNtCXMkG7T?Yew^>=PK!~Hlr0{-0h0cNAJ8> zRMzLFz7aJv)Yh)_s)^L&L*nDV@qfeg>_<`z1z(?s}}3tE4h|7_taB> zPfmmOCFZ8%>`gyf1@|7t3;e~mwBRCDDw(Rrt>@O}obs#1?!W((+9>d$b7t!{&wR!P ziQbn0@j=&sw={`s##Uc@uS^(tbShjtsk=qrU1LW0lu}BplIfzv{fwxNsSaG~b|ryo zTQ}YXfp6o?^sSHW>s~m;l@h6wFbIPw{Z(IqO1u){{hEZgrTdF0o$n;hYIm`h5ejym zWt^w~#8p1J)FtfY6LvGmNQ~#n>4#mN4B^ zjrQk)Zt%k}GBRD>l`<~og6N_{6HYKDtsAtd%y?KbXCQR(sW8O(v_)kwYMz|(OW zsFz6A1^abSklOl`wLC-KYI8x=oMD^qZBs}}JVW@YY|3&k&IZ_n2Ia@5WiK>buV!E- zOsYcS4dFPE7vzj%_?5i2!XY`TiPd*jy>#C`i^XG8h?f35`=)s`0EhQBN!+YrXbpt( z-bwg_Jen`w<+6&B`hldU%rr&Xdgtze>rKuJ61AI12ja-eDZZX-+u1H>Sa|7pCine9 z&MEhmT7nq`P!pPK>l?I8cjuPpN<7(hqH~beChC*YMR+p;;@6#0j2k$=onUM`IXW3> z`dtX8`|@P|Ep-_0>)@&7@aLeg$jOd4G`eIW=^dQQ*^cgKeWAsSHOY?WEOsrtnG|^yeQ3lSd`pKAR}kzgIiEk@OvQb>DS*pGidh`E=BHYepHXbV)SV6pE2dx6 zkND~nK}2qjDVX3Z`H;2~lUvar>zT7u%x8LZa&rp7YH@n@GqQ65Cv+pkxI1OU6(g`b z?>)NcE7>j@p>V0mFk-5Rpi`W}oQ!tUU&Yn8m0OWYFj|~`?aVFOx;e`M)Q!YSokY)3 zV6l-;hK6?j=mp2#1e5cCn7P6n_7)n^+MdRw@5pvkOA>|&B8`QZ32|ynqaf}Kcdro= zzQchCYM0^)7$;m2iZnMbE$!}hwk&AVvN`iX3A9mB&`*BDmLV-m`OMvd`sJ?;%U`p~ zmwow{y6sPbcZNQPZ#GQS0&mzy?s%>_p>ZM|sCXVAUlST;rQ-3#Iu!-bpFSV4g7?-l zGfX>Z#hR+i;9B};^CO@7<<#MGFeY)SC&;a{!` zf;yaQo%{bjSa8KT~@?O$cK z(DGnm7w>cG1hH#*J%X}%Y%~+nLT*{aP08@l&Nu}>!-j|!8lSqt_xUNF+Y}SQmupyb zPua2PI;@1YaIsRF*knA^rJv84Tc=7?J2}!1kMfHSO$d$+PK*u?OI%=P7;`PHxMB0k zau~T0Wk)rPEGJ$NiXW~kfPA#m%Sr|7=$tHelF9A6rFLa$^g{6)8GSW*6}#~Zb^qk% zg=pLwC!SkY+&Gne((9`TCy`i`a#eCS{A2yMi>J>p*NS*!V~aAgK;wnSOHPULqzyj- z-q4BPXqXn))iRnMF*WZj17wUYjC!h43tI7uScHLf1|WJfA7^5O9`%lH>ga`cmpiz( zs|I8nTUD4?d{CQ-vwD!2uwGU_Ts&{1_mvqY`@A{j^b?n&WbPhb418NY1*Otz19`1w zc9rn?0e_*En&8?OWii89x+jaqRVzlL!QUCg^qU&+WERycV&1+fcsJ%ExEPjiQWRTU zCJpu*1dXyvrJJcH`+OKn7;q`X#@Gmy3U?5ZAV~mXjQhBJOCMw>o@2kznF>*?qOW;D z6!GTcM)P-OY-R`Yd>FeX%UyL%dY%~#^Yl!c42;**WqdGtGwTfB9{2mf2h@#M8YyY+!Q(4}X^+V#r zcZXYE$-hJyYzq%>$)k8vSQU` zIpxU*yy~naYp=IocRp5no^PeFROluibl( zmaKkWgSWZHn(`V_&?hM{%xl3TBWCcr59WlX6Q{j45)`A^-kUv4!qM=OdcwpsGB)l} z&-_U+8S8bQ!RDc&Y3~?w5NwLNstoUYqPYs(y+lj!HFqIZ7FA>WsxAE7vB=20K zn_&y{2)Uaw4b^NCFNhJXd&XrhA4E~zD7Ue7X^f98=&5!wn_r=6qAwDkd>g#2+*ahd zaV|_P_8e%jiHh7W;cl(d=&-r-C}_Ov?bts8s^rKUWQ|XkuW!ToSwe}Z{4|kl+q&&W zn%iW48c5*ft#*m)+xSps+j(B5bPh&u0&m6=@WgwBf_QfJJzg2Qdz89HwcV`5kZ#5z zw;W&H8>5R(>KRwvd0gh30wJHA>|2N(im;~wy1HTv_}Ue%qb)>5qL^$hIyPvoT(nk_<`7F;#nS8;q!cqKspvBc<%xMsQj*h|>`Z)F6LDxue@to))OIbs2X+zY2L9#2UNrR^)?c8&PFc?j*&Q-r|C%7a$)ZRQ->#|?rEj&M4spQfNt;J^ntwf(d+q;tt)C`d{*|t)czD4x-qw{Chm0vuKp8axqy5`Yz z1756|;JX1q(lEieR=uT;%havqflgv+`5i!Z`R}(JNV~&`x}I9Lmm;aB7Bnc^UC?>W zu)(J7@fs}pL=Y-4aLq&Z*lO$e^0(bOW z3gWbcvb^gjEfhV=6Lgu2aX{(zjq|NH*fSgm&kBj?6dFqD2MWk5@eHt@_&^ZTX$b?o}S<9BGaCZIm6Hz)Qkruacn!qv*>La|#%j*XFp(*;&v3h4 zcjPbZWzv|cOypb@XDnd}g%(@f7A>w2Nseo|{KdeVQu)mN=W=Q`N?ID%J_SXUr0Rl# z3X;tO*^?41^%c!H;ia@hX``kWS3TR|CJ4_9j-?l6RjC=n?}r&sr>m%58&~?$JJV6{ zDq5h#m4S_BPiibQQaPGg6LIHVCc`9w3^3ZVWP$n>p7 z5dIEH-W9e;$Id8>9?wh%WnWf>4^1U<%vn=<4oNFhVl9zVk+jn;WtQUQ)ZeEjKYy8C z3g#tIb28thR1nZdKrN}(r zJdy-Y3Rvr5D3D|msZbmE;FLePbiM0ZjwTIQQHk)8G+sB$iwmEa2kQv&9Vs9m#$_8j zNKz}(x$Wc(M)a9H-Pn?5(Lk-CmOS(&+EVLOfsiq>e3ru6P?Lp>FOwPt>0o=j8UyF^ zO{(vf#MGx^y~WaOKnt%I78s}60(O#jFx0^47^Ikh$QTar(Dg$c=0KR|rRD|6s zz?tEX0_=(Hm0jWl;QOu!-k)mV?^i(Etl=Lg-{ z0G}CBprLX60zgAUz-fS^&m#o;erEC5TU+mn_Wj(zL$zqMo!e`D>s7X&;E zFz}}}puI+c%xq0uTpWS3RBlIS2jH0)W(9FU1>6PLcj|6O>=y)l`*%P`6K4}U2p}a0 zvInj%$AmqzkNLy%azH|_f7x$lYxSG=-;7BViUN(&0HPUobDixM1RVBzWhv8LokKI2 zjDwvWu=S~8We)+K{oMd-_cuXNO&+{eUaA8Ope3MxME0?PD+0a)99N>WZ66*;sn(N++hjPyz5z0RC{- z$pcSs{|)~a_h?w)y}42A6fg|nRnYUjMaBqg=68&_K%h3eboQ=%i083nfIVZZ04qOp%d*)*hNJA_foPjiW z$1r8ZZiRSvJT3zhK>iR@8_+TTJ!tlNLdL`e0=yjzv3Ie80h#wSfS3$>DB!!@JHxNd z0Mvd0Vqq!zfDy$?goY+|h!e(n3{J2;Ag=b)eLq{F0W*O?j&@|882U5?hUVIw_v3aV8tMn`8jPa5pSxzaZe{z}z|}$zM$o=3-mQ0Zgd?ZtaI> zQVHP1W3v1lbw>|?z@2MO(Ex!5KybKQ@+JRAg1>nzpP-!@3!th3rV=o?eiZ~fQRWy_ zfA!U9^bUL+z_$VJI=ic;{epla<&J@W-QMPZm^kTQ8a^2TX^TDpza*^tOu!WZ=T!PT z+0lJ*HuRnNGobNk0PbPT?i;^h{&0u+-fejISNv#9&j~Ep2;dYspntgzwR6<$@0dTQ z!qLe3Ztc=Ozy!btCcx!G$U7FlBRe}-L(E|RpH%_gt4m_LJllX3!iRYJEPvxcJ>C76 zfBy0_zKaYn{3yG6@;}S&+BeJk5X}$Kchp<Ea-=>VDg&zi*8xM0-ya!{ zcDN@>%H#vMwugU&1KN9pqA6-?Q8N@Dz?VlJ3IDfz#i#_RxgQS*>K+|Q@bek+s7#Qk z(5NZ-4xs&$j)X=@(1(hLn)vPj&pP>Nyu)emQ1MW6)g0hqXa5oJ_slh@(5MMS4xnG= z{0aK#F@_p=e}FdAa3tEl!|+j?h8h`t0CvCmNU%dOwEq<+jmm-=n|r|G^7QX4N4o(v zPU!%%w(Cet)Zev3QA?;TMm_aEK!5(~Nc6pJlp|sQP@z%JI}f0_`u+rc`1Df^j0G&s ScNgau(U?ep-K_E5zy1%ZQTdPn literal 54417 zcmafaV|Zr4wq`oEZQHiZj%|LijZQlLf{txF>Daby+ctW7=G-$g=gzrzeyqLskF}nv zRZs0&c;EUi2L_G~0s;*U0szbJOwm`VOm zb&bFB*Zlt|Du^h`NJ^-xF)B#jD@=^b%P}y{BFHh&PEAbLt1vIH?Ht}sFpS7dDooPJ z(0_wH3pGnVDAb{8!J;TWC^Q-AYfL}UKEb(jzIFcgpN9N9%Kx4l_}^~_XUqR*TK~5W z+<)j;IvbnWn*X<|X#c9};cV>aXzu*~m|T17q+I_UdhzelF#LNHQ3nTC7uUb`3dR6? zRaawYS951ZQ(I#fmuL-bk9iH`FZA(bGI31HZ&1?kBm+|>ss9aSKpTK9Dg4<&x!V>@gR`lX zy^Xg5%k@>l8lZ73w(dLBT9@~dIcGoy8tI$fT{;8 zx(XIK!6F9cL=ga~%ZRm{=BA*(9DypErmb$M&JewABR;z|BMWLmGfztno18wcy%$(y zZ_i5Sw8efIuaH8a&NkO%y*iPOvBPv*@S|Y1aY6sFD}6@2;Ft7zvIV+@exwB@CVSQ- z?`^3@Apb)n3MO$oBU8FWWKo5(ws6UKXQ2+d-x9lRlR1@Jqnd1*bqos2g*EnsqMo75 zVqJ@KT)w+BsQ0-qANf`KeM)Ml@ew%uB8(P&O?_pSqZc{PN@~lc0+ZM0q{X!Sgwy!F zu67f^rdT;XSDEH6Jx;F7oUFZ<9%{m|fktU^WU%8%O{%f7z|5#Bq=xM$c3=Jv#Arn4 zHTu6+J60j<7>rX4)Z9VJ5NyO~?*_kkzsU+n_3CdVp97KPbc(y7_nsWX(@zqj>X3*B~KEHb+!+la$lsaNVnOL&^`b?i;QJUCbh-8XW& zG{yiozD?Vt0~%IvxD?BoL1+P{t!b+NU9>mlMYdPWSK-HIOL1pQ@jhBJHC=MB1G+Ep z`UK;`+kghINyCgU37t8IecYSTB-LHKfGF( zgjG-jH&Q0QjHAD#J2$R{S2Y{G-XsFT_AtiCtqG3RoXap;swWtV6C!&NHJ1 zevR^gm72B1xLUcg;*=d?fl#8K=BM76D$-AKga9=?57+P#TuS%ShyW~Gi1n#A2jbmb zeInTF(;{^ZT$p9FGNb!Nv@2#!HTE)N+GWWyfY{7*Xgf7UPw4;^FU--*{{TJNCpq@J zykfU*PQAJ8$=F-U;!LW@%RQ2x!+y*b^UOn5CLntkXHHX@voEpQl7n_v-ob2Yg=W!g z&C8Qzg12Q=%iitfDO4@c`{teGwL9!|Ni6@ckr;c zbucy~XZgo@=@+E{+sBL?vTenoL+8#E1h*WT-Am+1!pJXTD`pELBU9d)0f)4cH-PSR z&VM98IN@9KybnVx*4Kk=BI?`3l``&EMq%96ST(DGelEKKVcf*l+SJ8-W6bK?CS6z zK_W?2-vLzwT>va`&>Y~TUb`e~XA@FR|AK)q6l^3f9}ZBlGkIeVfvH@*`epp<4k+(C zhqZ3Chjb%_a}A;{3bW{!>T{g!axLIt@pN3{AOwL;6Z}7*C9RM& z+SGh4u~5bRVsNq8k$*f=;nRf5i+?P(qOlc*MSMfj-MY%H7$gy!+W^K7EP#bp`T7Or zClNK#hSZaUQn7{qNlnj=iGyaav8yhZbwWiM$9l4XU&Uc~vN`hBJc^3oc(cJzWr_@M zmGEYlYq%eogX`;iVj(pgi6B<6@x}fK2R87Mf$Hgz;E6%5IyoohLyr4PJ!IkW^#*fu3kgflOhbYSQa6;~m?ayh0|${Cq7b^y?O73JDPegc2VFgyg^9VE_1qvb5oh(3jl=l-4$Jq9utmq-%|C zOnNZiaPfXJz)PZng2yB4kpDKajcp(U7;}(KPk}n?a>a=4u`6seI0-76P$}v>8(xHB zz$ji6GuY2BeRA0)_|I{EwgKK0gaC8*TmB6?cIYKdk4Ju2e$QP#)1B8{kH_7wr_-P- zG>q8NJ8gl+9cuksmS*?bs~z+ing?f0Coh?Sh67B17jrO3du&gPZj&9&Td&oR^ukxS z)sN7?_1pB&?S&g%$n=|a$i5c>ux{XX!gx1RhS1C{1Xw`0Q2Zp(_z@7YD_Dr-rsRcf z^}`E6!cTkH5c@^$BPq1z~_Gvq=va%KWai9a96@oTz!Ft zz5A5GzdC8xq}A}aNkQA7aY@P9^-t1E<5WW#t=){RJyR&p;FXzhU1vx12XPgGIc5ui zjcry-;y}hF9Biy}HqgRtj<3lqbG#fSF#ZGvj@wKwQvf$1<(EW&^Z(i0I55f3FXB*fX9 zKGmgejF52=t9xTZfw0~7OP&~*Dbf(65|SENRVHlFMjB2=yDh$RXWA9cv~1zU6)>Aa z$iZh*%-X5u$Ixv!hox#rp34$M1)n(&+a}Al950(5XA8fv&uQT~H2aj#Rg`7Pyx3@i z1E2H#lxzl(D-$oxvTRgxoJ;pirwrBUHP(rZzC=}0dS&J+3kmXx2iii1G4<&RSz4>i zIv+rxctLxEhK|G7ONM7k3G!o=T%i-dkyMu7UT(2H>9l>qVxR7ub$TE_R6nkqJ7KU% z8}T4+5Y;nT)#``8eoaV(H*uZr+Kxn_+O(!zj|x);%hHgU_+4fNAar{0Tx~cd7lx#l z{`>flGz|}q6^dZ{37<~FoYkP*cA4b&qUBuEGN0+Ov5b_GMR5s*X!+EGG7%LUmxbKs zxu=HCFwyTUoPgvmI-~OKNof-BS7nvBE+dT$y>HIS>yP6DtjPF2vgNW6<(pAVGb;R3 zw^2elw*a&C^nGXb_>0NGMUfI$WjWpXr4&!`b{%=jA7SW_T5~zOI99v9e~es^*2k|-S?#>*p@Q%s%W;R9Mii{yMU#lL(aq* zuP4{Yxi%M@LM}TAz1&4-F$XV3Zb7dY`MF`|tLpu&ABRQp@#U?-< z6ejkK(Fo@#eOJvKdk3EPCmS{^uctjG$N7mlmIn}38+LgDtJPVjo06KL4#V9QTvPK^ zT><&)=*_^a;uf(Dz#dG;-~iNZ1C4t`d#XRI@@$Fdl49Zz;?HV!u|!50ly>uaDKw9a zJ;GVjJu=Us0XWaN&|haBwBt4=H8fWk@A7qq8?wR`0O^hLOox4%m{2YH+X zV>4Br>?C5|^vZcok6g!qvLa3{$~-=0=W}}H zHms-QZHPKuhfEXe^1ZG<+5k%vE?`0>Iz%<%4uP-EfO-}K=~13`v*~(>7MY)#HwwJo zET_}ed+%nvXD$BhS!p>QWn!dbtq_z^C$ka85UXKnZO$TFNl4B(k{$NRN-;-hSr1v3 zkqz+NNv&;+2luIIM2GjPV)oq4>;gWfe^f%4&IA8ae=t!A%JnDUjy2y|-0z6xGy&y`bj|l;t|2@e#k?U*OK}wA6pJ z{m_kM9g}q+vwMfS1kfeyb=K7#5b8*lJTc4NlkF>68+#RwM&rSyOsPa;r1RxSdjr&0 zvnad#Qi?=i4pp=pi`~raumDwh2lS`$$Cin+*opx%(RF$91HVzri|$}iWK5%0ku0^i z8CRd1U?pS@@0zkPX=qwf<7MT4cc3Of$p5(mjpM|nSNKze2f?qd3aLB&Ad`+h7x7t}p6Y7xX z0?=TNs+=R;*YP{5#(mc4YguAOG6xC)c1C)mxxws;&|dMUo^&%E9Wk1v4~XJ}WlkD0@D)erFynxD?W* z+34y;-YQy+sJB)I18912-5YlHy5j1(@9JvJZUz#$45%%UM!Li5!7aHAqnq&2mm0F` zL!V6rgv}-l_F~{wE5QV^Df+Dhz&2aPv)|eT^|FurMZgQ0D$vYBIhvY9k|K&)&PqeE zNrVN%Fcd6cX(yzMOp5p5wg{eUKFp?UQ`-LcIHo7O1Bu&I>SAP99vQHW{!FQ{(Stre z&$pegWi#vIT4i0rg?_MreaERoJ;JKTydyf(!BVIvjpZqa8oC0P3iCk8)2;HrJLqzG zCUr19d&Vtze|Z+YWTz2mMHmtM+v*gip-~DHs3j#=b3IEM=t!P#UPppDVq&V~s6b~h z=i|!L2545UFKMz+(kI8BtzSXk)>nO`KdLr%!Q=`+o@64$-HIP%SgzwB+-eHHWNKdE zSk`NLT4-D-cd(PY)Y;(Gyx+2%*?N*u3)8J%agtS7^RebZYYVLXXyC$2(LECkX+q{D z^LBGlz`UFeIM0dDy*erlLw}z8cn=4D4lMgUTz}&&!t$9N4tQq?{}zQx!h$~p9>e?siDM-d zQE4hZ!%V;$MCF99lyHW|9hg&WO6;=NNOPGu4ZOJPB5Y&z6kYbRHl8XTSn1C63CZ!oIQ@jC+fp&OS7So zcQH>SYnofs=_kU4Tk@JcsT%{FqWo$Qs;4_g6DFt%KsTgiipy+?>&o1@+OAML<^cC5N%+1VYELC0!xv!)#}H3$h5 zB1(#!PcM||1Gd?(rYDIFfw@;&P^RE(KuIONcXntQes@aDHT1R*!TTO?g{X@O2xd2- z)A?aBDRy#eRVHf$ zf4`gMsAE{|&QqLV)#zQLx(ngltJJII16bR6C~9Ns(}!4AlOKYe{HeBq8W zP&li4QGNo=)Q%ue}Q>2iK@*pQz~wv0v`FPq{U;g9)6)0glZ*r zhaIrp@o~prt>E~hvE4axPq`QFL)u&TI!yRv1_tETQ32<(cw!An1gGeYt0nZ|lxE4U z3uvz`%l?Y#A~LPs~w?7mC(aCsi{}Uqy^=`{*{1?t2mX*J^S>k!dsU zZxuQAS6Kf0YVvQl!qVB?#YGJbT4d>FuKGw-Mlr1`1q5=%uJg(3b|<9 zg8y6?&ECjF>Yt^2q>}>D=%&rVU3%?4QSOF04GWh9i9Qx% zemGXIlzbz)sglpN=VPosX0@ak&y*wiRQrH4Ny=0Pg0J09$hrQ`5gLD;V1wTmIAIBn@2`v|}89LG8J4OLJkJo{bgN8b9QeWaQQg?Yw2zLY?O`j!5UzEGSWsr-Stx**fh@ zx^q)nPZcb^mEU~Zf5#!UpiRH$Gj#|`i_dWlpOuixgU8>&!YE!?fWz&gnNj7>67m96 ze&=@w?0u|g?Lq`@?O~jkC%MskaPpzNH1YA#&m=u>=oq#3CLS&n2}>Di7HT35*?{H~ z*Or~}DE1;01}r)+7&{NRU+#nplj>8O6@%}2)yNNC3LyJ&}PrDBq0e{0}1>)B|$fu}e0 zfd$UGqK93YCv7-3R6sQ)FnHOQUA@mC{Pr4mN*vymms=>YtR7LxjT${yUpF)gr-B~6 zmAwb$BNa(;mvc!zmo35MHA26qRsM}ZfL4zh5;;*mJ8|{rr&O-~D=^B|Ku6HwUHphf zTA=GNxl==aS19WK3O^4z~QAhV|FxyO(u@>*7w;9Je4uXP{;lre|%=2T@E`?Er1;kjt^um?TawZ zsYU%q{FDSnN9OCrtly{Jf!cRP7}E9DW#s9H6rgD-0^4d0tW0PrfE}s0f@Orv9+^NY zLJ5k%)PTtzyqCJr9PAgGE%xsNEulF$FFgJvGdwtrkn`=fBzrcgt?7X*8&m#RPyN0ojCufV=+I?4&&N7~EbUreF;6xZosdi z6V4MXJ}z{lYS4f@Z1-vX*oLKx90rQCOfs9)Zt=;u-(y&Df_XES(pa2hTT=)bP*t_{ zJQcvEjoW4cT>Sofn@xa*ke8spqg_N$cGHJE+lSiG#qB-BcvvXUOve4Egc#>v+_GDj-TI7@BO4QEe3==2E zn#ce~MC?A#TN$AzRld)Jt#0YJrrYe~iK1Hq<@0{EbE`+1WVI8a$C_kIi~%e7;zR3& zwXOn#$Uf_S&)C%czJq3NQoHzw_@>5)yRzC2JpZIK!fy%N1mzJJ1Y={DR?AZW^*tdj z`a`qa+9iMdnK?^pwPE@7CqhYr%VmXuvjWE)1uf07+i-HCp?uk<5<@yfpfHfM&!uu) zLSw*Wc0954w>QVqg}TPE!qTxF{*aw7PPY_dKo9d)KQ!)w&H%LlVSfpCOhDd`fO@|_ zP*k@d5-9zEyj^%@d@Mie@JntI_qx{WL;X+>C@0E;5eU}eNS}urcy@2Q8KoG@gI-jJ z7TjVfl@${^z8doyMaH&^^%=Pqc z1xWzh$FWq2%wtJEU+yR4TeFeUVeB}*Qt0uq*n}kc{6I;C(s$KA^v7B+YF|;+fj%o# zH;j9O&tCW?Mp&DYM{mEN4K?tYZa+vJ7;jcPHcYzkN*r}0rp0NHE&u!{#00#|dsFW( znxOm_P53XcW~u)LY^%GNJ4-v*naevk*tj|V2iB~rtAs0p{v{cwzx1e5N!{3FtqZQZ zs&lD6KQLY%p$1J1qhuBWQ_a|JrfvJ7*-36~JvS`)AjKijuR=HSvwgI6(xc1eXky}8 zNXQ>ltFJsrd1BNve}^VpCY%P^$Usu>B?4KpmUy={=od&QvbVCNij_j29E==%g6`YX zn+UDp+Gw>y(ZigG;&ih6e2#0V`5#+AMZG0 ztNA*-Y-1mYerxBw?vUkYI6?Lni?!nCxICe3YG!cGELe)DLivnqE}O88NxU#jEI)4Z zep>8mnh$s89fCB3Q1LOR3Y|p`TFhm^cFE2ueY=uFLiU#S^99c_C&hF(YrmE?6ie)A zst<PZ@(vM>EB)In|C#cOSFG;^Qag1y zgj5`!R3qFSK2~OmIJEV=4;7P|@`+;pth+jeM%PzW6B>glHyEnyi)Y~mIl=`#AdLR0 z&;Ei!)VWyQ{fX&cv&i#G>x5$1zknAu2ng-J&#L~hO*Q|)sra9?i2nd5w4i*^mT~?F z{qnnewf$+!ObRao!eko~7rYX@P=|nRhG%PPA}xyeS}Q@G6{i?w;YLm%lhNc#xydF& zC8N6j!u4tsP>6el36DeAuni;db(qP1@vr0obhy6O64A6Pzh(&+mh{ zqlbe0g*%`AzQPg&f~BNDm{$&(6r|BZW1->?Pw^0<*s)Jj*r{?)d?Jlo6koN$;TtE6 zoE|h-!Ll7y+NK>DjGQ6MkC)2A*G!@u%^Qfvxh_?!{n&0yA7Jbz!+!R8w~i0#|`_V~YNbyqCW$YB_*e=t$S3ygpHjwLPRtxMnZF`L-F)~j%(Q?0&01qxDk0>nY;4S)%g|fghTsdi7;cSKs zKBvmhx7`+!B=!PtUumVmgDr@+$~r9_BmDvS=uj!uH|Y)N9O={jeM#Dm{;ewycL8sD znF3#!FIf6&AuZeA4EjpZ@rI4VbwAFWw~9)@X$hiIakdD7c>GoPN@@HJCXza$;E9O< zoh+8U)dy>61|uzy%>*Skzd)#T_?}OpqKL45VTa16dsv6>Y4@ zFguPH^-&9k=?A~~nzQ8HNq85reor!^^ToJUou?-x|S%+N&^eC1iV6T5-( zkFD?6;~~|YudJ90Sb4Ae@-k&wj0Ewa7+cHRlWZb9<9{hYiWCf=W>eUwvYHdW;$+wL ztc%Uj6Zf2;ddr~7<5}k{C^0zJ<_B0Ff_w5a?KeknqYi(_loL!1?2&y+E`&$x@~~(4 zby4D-Gi6dr92s&@<=-C$^BQIBE{yNx2ie7ea_9li*`xL}5Sn)^5Tu;g+Gj&xW%`+J z*!9&<6eU9g;PB^;;8`+;Q_*q#BMfO?8bh~tng@6&zdO^Tv7OW_{E>pOej)I$*+qIO z2oeIkuzmFvrqh&Wd3#q%5iQ?nekk;B-y$IZHp+I^kKisb`4*edsL8~-Nw7{ zW9xVL5&0(3MqA2aYoWNQsMz_jn&p_jESuJgX`W7&w0wB&$XAqAQLnr8PCysDhz%#R zlbc%NZgFZ|*R@Cn_=|P?y=U~oew!CF$Tr<$?9PivP%j4eg~JM|qnWp4*&XPF@-<54 z^5=+`=IhM?Y_VKUZzD@*#EVK*20#_)(Z5Nk+2l*os|=VZEJRYcu6bFo@M3d=MHbA;<@iH;I8zLXib$FZ8Qr%`w0X8qVK6Y-n@N**pyG{kYvzr!mC!KXjc& zAEMRysj08<$s8Z?86)`_FQV)aAbfbl%`4qkA3+~OTG-tmL!@A6$8|OgJ?r^4tzBlN znM+p9n#>`db?cTp!=^$)e#5kXbwqVChMW#vd+}BbuY;oZHw6_FJ&YkKp-gq|dmXtk ztvEA2;ZMTq&z$uBzRBJkRf`zEElKC`+{LNo{&}&ns9MQKb!6V!*+Gv`p_$U3m&`h} z--a)%0wA<4%TdMd9BOK7jhp)@$FU0Q;Ks)TWDQpQAjq9}-D0RHsbH8~DKc3qb0k3= ztmYO9-G_P|a}H$^oQZ6i%8cKRcgd8ghuRyl%s?W^xhm@Zt0Sr>MlsNE(Us*55l>Bc-v;M26y?f*tvdw|Bf?-?S+jOab% z3E>T`4HKe&%Vbop}}vP|7>y2Qt6 zlFnr@gcJ4#h9IUD61@W16Gj|bo6~>8u`wxz^W5*{lk^Ve^$vT5baY84LvjEXdj1$3 zOaf(-Tj&J3CxUl~ysU!P0?OsMh!1|kJ+aLy<>W3Y3qs8m(Y`hx$!DEt>I7Q`)fz{5nSzg9fW18C;J1vM;xW z1t@HDN?xv;lq+g=if$eLn;JN%y#VR;yKs@{flG;$noCZ1d`W39UxTBRQ_*-jVJUq@gBrpJX6cZm^6^w&mZg$+h|cDKH?s>%6ICDto~!{kHn_5*n0TZtYU*< zr=VMIz&OguE|;N$eQLo0M{Kv-!vXqPC?41&npGJcIC05 zOD+ZS)LuM{Ew$Nl!f-X`a7>MB%I2qQ)`E{F2d70H4RBIhFMZIw{aQ@I3|2QZgVJ$O zd&~-+mC?eUG0rUX3yy%mk|I@x_+u*SFC&a3!iuu7=gCy zmAx-0Mw5kp4DWi{03WHs0>Dx=mk+2fa9+aVE*JIK$sfs{14wE_hk2X2YMS=ezVWjh z^`lrju|B;*e8*~uG@t3e)_0U~X=VxZ zU~%(cvny(hPMjHtYW->OYqOkSy8j-=Q04?Kbt)+J@Sz9p(yGX*#O9fhFXD7|NLU-w z=Sn0xp=sk{GT+cU02PdlXXl_y0tScPoMhsl54QaWxd)s_>qc|S23-lWbTLLEbD&=c zj+-iBifjtdXjY~Y>krbuX1m81S}x^(v)uK+Li+EsU73IK*#42_O8jk-_A$eU{+T#E zLPzOGOT{7{s>EFeMj@2OtlKkxNLi z5XGg7ndHvfHN$6F!KK^}-w%eze|0vcmi~hn=Q)R7bX!C-$P%OKlsS}!Jr#LC64${N z>Mtdp-FyiGx&b{P5C7kp2&VM>}FTP7n~^R$dtubZy4o0MGs&9r9+;daj6UW7_yk1KW`U^+f_K@K32- zP!8y$b+=d3nx7cYReeBM$L!2XHhpc!AXH>5<`#mUlx*xYxG%=czv8V#zVdL1db^7{ zOcg5{b(-fhi;^Q;V~bDj549X^`ODa2#K_G>;zbl#k*u>)aULhlINccV3j;(&Sj)L{ z9C2MKVOrD^jmgC8Rw{)-cL^Ra7zM*?rrEHwBTaO&=2c2oFuHrv1FO(CsjF?eO4zMT3G zY5ZV!;oD2@sKf~tudyhUT1b8HQ(STf7WVni=Qz6HcIEF^yrjo$dM3m$tdyH(usaO6 z6ZoywR=P%j^&DIEiK!=}RzKxRqgN=3Cn5=|*jSQT}9phy*mK-+cuh@-@ z$=NC4&F;VF^$*Rlc?pTZx{*WZp1aLodFA*^Km;qcdou|RHZ{_}rl0(T>|VTykJ;We zN9bO@h5Atb3qU5lDL_jVKeSWuE$_DYOO1Ms(7OJjA?O-ce54)-RVX;&^<)2_T3ySz zO^@k@4ifeB zT~^&=&J(UP2y*PaxAB);bQ$kJ$o>HXIW%H1NlN!7x%4pMwtPmpo(fz%qZ~RqOQhtm zUZ~enOSqTw)7)pknuGyP@-$?C+ugG-&2V-?u-OY5!kl-otJzGM0HpO6u}y8;C#J?M zA_VxMS~ZEUJN!p}Hiloej47uBt?0Sly==s!k4q#S2S*H8pMH%?iG$SzvvRCt{NcI? z9fWg8GQX#Iuv5S0G2j@jK6*BM7p380Ge!@aU}Hydr`1O|$^xx__cn5lJ+G;Q1wStS z;;m}mIo2v)jy=w`L$P``1Z(g<(i@kl;aQnhRiUt zQX^-V8Y;WV5}mB}%r06c?uomrM#>s3O^cEx$?gWTHossiBD7Au42H+jqfz5q(=WII z=e2R`pO0D9{DFW{S8dQ9v=X-<(U4eo0J|r}n8$&AYEExwI8+>UnDXM9&#pEUNmIG` zUGg1WLpfI*TYiK2Cms_x-FnUsOu<-3E3DyNoJxEhwvYtin>NRJ2~#F?iqm|mR!;AE zdHE#_t!s)CThf>ofqXT}eZ-AEvJ4av#UniRD?)h4exz9@64=d>)aWP@g0bvY#3;TGu`T;%^DNQ2qo<8hqFpH9@kT`d4|JG%|&{K1&EI%vi)5Jw}-C z3@KyNtbnniGVH-5y&}iPoMRe(Lk)W989f8)ec(rjR+pUkMiHxr`wz-{R-xq)53g@E zJ1(Fd@zV&o9@%}3-*jLNQgta5ve+L*^F*jCpYC5-e@pI4hA`dShxpsa2R44=jm;?1 z#@c!GjqAfhw~xCT0^ztT2C3Segl&ejs`_r&kM-WF;BOmOEV^6u&3bp5+E?ZW=jihs zNaLNAkVC??JAf9n(y2YC-#;e2*87`>V@c`4p`}2XtfH=ir#|RG$%XwcrLrexQ)^Z&j;}wHPlW zFp6I3przkl2H0G}aJOo2I4i}xuC%X{C);Yx1i0#x zW;ZmnG-?BjU4;UYN3j%K-OniJ8;XNhwKoCQais>G>kDn|ZuM=W*#n9J&{>HU*;g!EOjALu!4U5gEtv~g~4Spck#6^k3iCLY=NE(#n9l4dsA8s zs4#%ByWv$lr%DMCO={$Tdr9-!IU2raw1V#GuttNP%IBON6m_ z?m~&th1##sAC`uhwJ_!)c>!uE!M%)Up;0Q5rJnJMS)l9RpWG9%#juX-s@cns3SW}X z>=4saFBhsp;|3&DO4;fkfc(PU9YxIWHGn5!>DSI)=%<;l^{!Y31%jA#&X!RztgezM zGL79?MR}Ca&nz}#Tf~u!EN7pcAeSE7>4#X^T!%b!$eGfDs7iqr(~uSFm|ufNpJuhG z!|ejqf~Ce7tHmB7VE zB;qXD@yE{jv^~}qNnPLsECiyf!L|02XsXv(q`M%K>xQjQ;w|o{jJWKxW1rL=N}`+`D}m=k%;lKVoxtTpB)-bL6v zu~o@r%V%oC;jHp=LOMQ(>^F}vD3zF*{#45W4~hARu@Fy~mKZh zhc&|CPWlQE9)m#D=Hudwtg0SiWAB_Y){9$tST}nR5qSujZa2$we>7=o?JV${^>`gn zlHZZ-H8+uB(Mw$M+Bf$3w>9J}aQ$0CA#?_mq+#y?<`7c=M+Z(x@w~8=Ld+&^rktNZ zM;DTdDR~krtM6!jvcgLM4yu(Ng>hVIeY15oo}}@ip)qNa!JXFwxu$qoeUvrHAU{R@ z4Z|;Y4&_YswB&&;3GxIdNlyTb5rED-M!OV3>*Yt!kvWr1XQME8JPl2CrwzuDNv)ByIeK<)t7@B80j>o* z%G%j8gxsaGjMd_IR6xiP+~Yp^NlZ;HY+WQMHCA1E36-ae)M@&lqe zBdn@2bt$UC>JcV+8?tP{>E)Dane;K1b0*SbB5BT{^_WN{Hto3U%EV~pjc^SpXtV*k zGcToMvA6rML>jL!P9GjGGWd%>0rgAljRvDxv_yGC6&u5!v_wf;sy8^Dbkc|oc(<C8sFFV5*QS z%tzsKRrVnzXC1UG^{IV>cO#!j|5XV5Tk>~})!hE%4qKLTW1u019mUWDMI@Bq#v$PB zakp`j6J-eD0IhcAwzU>dq>C_9#}COEtGUO6?Jm31{b(8!+95KrZ&uwe`ylg|I`qKl zqIYJnReSptkbk43{*~79b^P%+Nh5=0P73%2b@vV$b=vROWG`*bNx`*!q!`iePqX!& zBug|)g#IObXn4O!`zO>vY>(fmPs%t0C(ct6(7f|d(}M%DqB!Bi0BcMmEQgDC$oGuy z@JWb_#*In9(Xms|nvi)#d zwfxzc(^iaQ-KeTD)wyy9I0ed9omcfsaw4`l!k+Tmt1pXi!z_~^VNZ?1K$Q6P(Lvbv zf8SnWA`Jby*SFs+qVhUQ-HAW^)p!#DP1#&cYZok8b`@?RWB2nLRB@NI4!DC%8Gk?& zQF_k>RgbcU$>fflw6aVA-Ii|)&{ap@9Uq#hu3nFzBxxa9FUOC+jJvMde*9B|lx#RP zuaPg2H6EeP9xg@5Ff6O{5^oIpOjoLHSUrc7YxH221#l4vBjC6SZECi8InN{ptB6<- zZ%p-Uew=m05X zxbVd9zF5#Cj%5V3dRHiL9k3arCezL-8zK(E3}l<;e>KI_iu$SOro)dSm4)e+n69?x z+}V6j@!er9d4l6$r();@<)JY2**4C&Z%6HIP*U;} zm0#hhej;+dZ#I0GVAOuKIblpy-1n%L%Cpa=VdD>4mg19EPPJIt6fecwI2*SMsI*Em zzmT2v=-0Ev)POS|6g!1GnN$7@_CZ|xP*PYBtmw7&vQv6S;IFf}cpJ3hE#yVhkqMBA(v~gLq5wo8=6aTjo~S9jWTvKhFG~bOP}2c6dADkW zP=1yy=s>hhD;Y05g>dD253>4mSIEcjG$@CvzZgsC!cXg8lB6_M^7JxinG$vXa%(@A zzxG(8uE8rem6r29LH+d+U=4ha6CYJYRzV=vV5OoVK$^MK;>akTCpdXM!CSc;oZ_p4N>P>~vLDa_VS9%y!7tib`D?(?XhhO%oK)hDi9QHb2&4NqAh_ z?i0OSnP2Wh;w$&M)d#TU$xHZv@rq^Ol{i&O1C9AGYkMugPWwL?`wEyyyDV*>k;WYw zcj?C6p>cP2cXxLv+}+*XrEwa!#@*fB?XTIH-JSV%_Rl6%LPCWE-c$FS^V~;DBQq97 zO`9RnvC?PT7pI_Ny3v(hO5OfYSD16JND@92F()^JVy|usM48BQO%&0?q31P}p&rm5 zd9Co{m{F(*T~mpq$Om{ZxS*#sLv!Wko^?Tq{K$nhWAIM6AnT^gVmak)M-&nGt+)7o z2U7S=^4AeR=hp@dg?Riv1UfUJWBnJ5@pcp~0{*FxO9@V)O+bbN{2L`tGUPZ@Dsm}H zN^kY^M3U^ZI^3odR&JYhFxiG_S>uG_v_qob#mymuroWPdt4F)TQ{&d9o zsHCG`u^g-1;GbRZ7<~u+>F#oA&L!iJgzXoITjUd3^IPK_ga#scDtSxC#SddgaaQYj z4W-6Z+y^;-TL(rNW1p_{8p7MV@eQO5oqtoYkvK-<@!-n{ffC${NwM@5$Xq*KS6iS& zj|ct|t>C9tEWC2gcm*PDLq(^xEPGhJe*nr^Gx110-|P;f z+Up$bY=`@%x;Y~YFXN*b^#-|^E>QL7--eW7Xo zDQ0>vSD|&o-{H^Zj3{Okv8`B-tr@Ra0&YFdG~T`w8`~F^qT%dOkfwlzfnaOzMq#-i zSpw_xf~jGnZL%X=fQ_)?!giS;hI;Hggi}GGX;(3&?_6F8j9}vo&>?S7bRYoL{oWI zYUnH6I;8Fs+2FWRpqSHo@q$DXnnetEs9Z)jdudz~hoEBLTQxOo3_D?RhBc-}vCze? zOcR&?l%>{zEFDwS;3BX)aECm2kRsGNedHp^Sam~w=|oVm1v#?qGqNS(>5MY^fTZ!W zAf6+xr5Y^Hne{~Sgv+HHSqbDZou)hT*4!&nccdxOT{##{V0*a>TR@NjyUKtROKGU= z=T|N%+@KZjgye)IDRg0%+i>?Ik03|CA%W3;p@a!CwQH z#;?mq263{$kA3d90rO*ufZHd6UV0>V^8(_1iU1&zvZcpJlqH`04iDn?dcBUg{D{c) zvC)6_%8bwsk++Wf0#ALf$r<7kV)Yc0d*}J*0!deO z*3=q!9aJx%< z0T^j;D*?|jJ)0xBY08~M`7H<5Pn{n zh$TOk{8|N-Xu~l+HM=LPfLSX5kty`MW_q5$XLfTK7{mVXcs3#7N6ww@v0mArs>;5k zhXX|wCy-0B^k#a*<3*@9=pX0~+pzs~bPWNAKvWnd4+g1MNX#@cR zLh$clG$~ut|Kj)uC%oFu$e|5&rwsk5VHmWNN=40r5mp7*GLQp|ppglnO~_xX5;LkL z&GXQrKEr*3u?Kz=ynT5qh&*hDM^S5t%?8>paOB+n@csCBf!{)sO%U5M0ZXx?@?R|_ zmk*>C(hlVkSWB`a58=k-M_-r&$xC7S9c>)($DL< zQRbZ>!}_baIDM$x@GBR4WLwE#P~Kbq8TeSW$O`II|&4|!^Cma=mQjVYc7r>x_*Q=7VhZpyL@}Oo@a0F&{3#AO{ z0=Xf;Kn+)rDRKEYNMRRM)%o`wXJRjvb;%0Cy$LptHNa>pn-iOl@%NI#hZTa56gC!a zah!mL08^A_E8R9fHln;(L8zzzH^vV1K6Dmi|KR7F?Te{a0a(i04pecz1r1?&otj{}D z*f%w=Xg0csTAr@#XiD;zO2re&v@gRaNJo51^vYf3@%0cWb29;EN|C&l z(i~rD9hb(sF?~Tg1}Zql^{T!i%1Ymj<4$>Z+{u$aS+fksDCN*^9);%+tEhL>pgjAm zl~YMy-59czo*}Vfr(OKUqge@y^fjNpl*IEze!kw&BlMgQvKVwHP%6KP3FFNh&B!TfCeku%D~K@nS0p{2 z9$b?zPpS8H{BEwkF=vAs;zBE7d~Cn!lTcxl8%A%KSu1aIwy*gVf0}XIp6+52G?RF{H+L z4vdOSHY6#qX~fqzu0+3;_L>qpq|E#vd9;$(?A!9tlM-|DqFCyL=570OwiU*sx=izQ z{yPiv4W%9IUn{}j$(-s4C`!Wqo2|$Hp%VU%^e3r2>*6dTf6|I+s8?E38*=H18B3uO zftIfiT1)RFQ#GT2CsGZ_2w*f~oQ5XV|EkYZ^=Om6q~e)rfAmgRh+F$3d+YgG+Pt}} zEtwli{>*%^fM2SUn`yBN7?^y&oPcTU9>sTv}c2 zhXliKyc+Bg?m8Sa$hx-bS7jXy-tHY0a58N6^dkq_xa zuh%KNC@6GQuD#Lu=xXq=%X&n!+uUsUb8L>ft=|OSz)ADcPOfeXJZjES$~t zEqv}rt!#jP9QM3ij_UkgF909KDKzJbSoK`c3i|S`E1?kwt#yZ#dxHTvJ0lyPhp@7+ zftNB82+b+XD6*m2nnYINem28o#+VG@Kyu=k^yFh5g+JN2S}I8Cl>22aPAiR(X`=_} z`gA9j!h&zGPsZ!4#&}kMHTZ2n;L;yEDKeBs z6!ZQOxNN56D~2)}2wN21X){bt<*f@JH4F`3;HK0MWiLNKg-w1X2)}sM2q>YiAc`>8 z+3QSZdHd?h%ng;L+Kx5gHb8vYIughqSipu3~U=%!Lg4l{g@jDNLYe?wK0{B?y8oX+Lm5R&oX(tm(M$_ZVIE$ zN2@HgNj%(V|EThYXK?7a?5&m>IR`mxwL*o-Q(B&&gvCJ!BT@p8P|}8v$uJ<(vRk$plI%`o|sK)?-&AiwZg;)#BcJ;MLGr)PH#Z9VmySdp%v zX8$O19~fVeK#=>__w1sCE*Cv7G;ks3T1dkMBSVbkm9+leQtk9+h5jYxeuJOAGr{JvYG)l@XGe!w zmQiuGF_UDsA^S7PxA`Iumf)VdbWW{Txn}tJ80o3LjK;-dcu25~NW8bFh?f(01?vQs zM|GedK86Ad>zib%y;)>o!qRTz#;}C!x+P+^KCYELyT5Xc0kaPAHJ$pltN7L@SvIN& z`Ruh3dSDGhQ-My5tnmjL zDLNS0*CL%0qD=A-faA`HIH>LYi-s<)=}Dk1!X*3TTnhbgr1zs}*`^Hf-omI+{lki- zx953NchjQG$IELBA81FYt@qJDVZe8S6Z+$RXDO=G>t2#5+vi+86&YfMUwK>B5RNbh z-e!G;nDQL7Vs(@Q(gaG>;%=45V{RqLRBA~($!mMXn3lY2gTE9yCOob(lo&8^+ z`!K!o)S8|)&C+Y9aTr9O)Qkw1)X#>^mX`1qv0hyRlHWcPY;DAGFE@X+N z6%h$U>s1ZTs@1$Do5AT84C@Hgp+8Iw>EbODXe+4gipS{e1eArAYI#^BMIlfyvz3O0 z0=F9JryYP1!=sgCziv1jhFSHJEn+G9x=9jWBYh8w>Jq$u#$(6zSywEv2GnJmb*E7d z4Ykd=T?BdOL1F*s_;-?M8_Q_21imERQFR+>LH8A~DB<6<4arg}`28ug9QVg4j|@2a z$CSICZ0`hz1^b{BKJlXlk&X&t|3VnSL7N(R2mg!R-zoLQhE~U9lhvb& z(k4-J02^4X)Mo3ki*=b36Wh@l)}vFNYRyaS0|(^+@(b}eg*pgDa-%Y_T@r}qa5!8D zb@a!)ilspWI+26W+}r?dbb?(}^qd_g^qgJ)aJs9afEp#QC|hty*$o9Snxqu9pEN~L z);4H0RI6{Sr*iI~MyF$rFqs@KNe@XvZad$pNCHQkqzpvC<{u4mN0mrfwEXFsR~xQ$ zhJK{Fae>YMB!;v!k~2`3Sy^a4%kcWRKl@0%7~W0Ua7*9oS2KyNk*+&ljxfH8AIhy- z`H@T7B&D>e|FtEJU{sOM!&u`7swv;KadXyq`8Me@V4gUosY3SHL;y@}^y@2Ug7y^J zqAMgZi@F2ZUKs5=;;U#HOHwDK)}$q&UD4nTD#Y(w_9+5Jzmy0Mf+5(<`QE9TSi~>; zWEujv5Ta9CyuUBq#rTZ9H;zR86lg%`{rIEdzxC0}Yf*OvW{7RI2+mcV_p`922EK~A z0q_a>1O?yUh!R;u9z;S!9n7{CTcDiRXwbV~NANugLgW?^riJdxnh$U_zU8xoG{<>2 z@?lNp?Sf>1O~-x7#Bd8bRcZ$xT=#KBFkN}$aN_H`n%--}^%&&wL2SzT!?E|cr)_%7 z)5C$O^7z5=%>xee`A9T249cE^?}Y(i&pbndNFdC$ukL1#FtJyc1otwcOQ3#wXd2oG z&Jit-LqVgD(h!ck)W}O%fQWSu^`ZX^QM08Qc_6N3(8%kAg1$$qe~09nwj$_+x-9Bp z-4UL0#rS>RE|5y}n5?NW+Wv0GRIAsLI+$S7agkn<>wQh z6J_RZF+n3LGbqEMi+KrF+a;6iN3UtKTq~LrGh7D~^dK5%c53EUuKs3YYGAs}c|X^B zeVv-p1v$8)43SJ7(PNFkjfA_f=Np>fW_xUN@0k$5jxgso`txATcXg)1R;wMNUu$pX z!w5eF6InHJUji4r@e+Ql30G8FV#sM-AkI=k^VrE0_yv%+p>*4msjFt?67y|F_iWb; zB_@Akj%l?nkPHAMxlhEZIX{+V+b%`lH+#<2cRZR@pl+OBq-9ypHax47qW1cqGtFUF zFS4#=w{6x%PG!4$S-B6&?5S!W7OY=*ked>%d9A`M&~|jlRgKtAy*en?dDMk8Bp1m~ z&;BUcrL8VIt4I$i|9mJH5&ac!DzuDT)?&I%;!G52kn^euIyCZV?X9boX^dkgBA@n*7ZQ$uVkM653S{JDo$K4mb%$zg&EEmeD z;h0mto;!szaQn_gc7Dc4Mg7bVj8VD-Jdt=S2xe7A0>1wOuPJ|fJB%e5nBmY zp9|hr068*B7$bgLh$trSC-t3QfpOT8OiUR*KAt~WykQ2ako2d8L~J9Rf@;7K5YK?C zmq}mr{y7R}#5uS24*RdQz48$PIs~*BPXzMWDF1!${zq*KyBQlg|F<8iYM3V~aMP`d zqjpz^8~#?y5C-x^AfCasH69H|aqUHp2FGG{P+ii}GprK50)30wT)?C7SbL?Bs8iNs zs8Mga6`Chc`tp_cGu9`|{a2-mLEhc%;p0X}+GED<#JFbXO%A3mWG&t&!gd`JKH}~K z} zwmjY42pl&F2BF+|r??3A=0p12k`EDYuj1&lcb~x;at`N3`=7o|5gcx#>U+f>%3fa` zBk`gRnlAfI)jb^=pZ&&M`W?~nLR`~@Hkh*fR#V%fD)@vwrEB`YMASiOh@Ea355Hb*jE?<#B~gi!ak?k1G+BP5_8|$XH;V*4oUN zr8c0r43zg?1}!Hil%2BtQj`WgfvZBXv>=ufC+|3;b-M5cg>_MFpP-y(h*Zp}aybE<$COE<_nKW#`V{Tx;g_Siaqk>V zc^Te9M4}if86*~iGxV5&rWJ(y#0f6e$v!M4HW`y*TRM!W3p^#@ig-W2tV|u$JTjGo zGnQ%2YBT{-pGP*VqKv7UV9&|6ORoOx{0kAaTy6>TnB_NhVJ>A=Y9i!U-y5Pr=*^KZ z)H>9bJ1bOL-uQ(QeD%XB@sj%04J5$bF$;6YxGOn3w`z1VTkzn!NwL$d! z7gZsHZfR{<)(?4c(=yyaQgGST*onj`fcgFD0P%=&X3{LN`+2;kyy90)EZx4BPi@A% zfEE$5-xhn;_5DOGD(&e3%w5vu@8Rk0bl3EiTgF-iA6oWqrHL(fSQAzB(BebIW)R$* z;)6nLw$wJ!Ch)|!0QC7ug=4Ft^fEno89PCkZ7!Iuh|9XZOU2c;u@m_#><*P)NUf@zcUF*=OK zNZvBb<S0`>xp5AU8;j`NOt+wT)T+L3c~Gz+}=V}|pW7?LdW+zgq@O2DV6EG^8pt?_lT zThsV_eV(P>CL6WFO*2`lWbiJaN`}@0I>RuK3pXQlv#kk1He(R$Lk3yij4;*7L}T}& zD`@lU3-Pd~OQ0hk_zzu!iE6i%$rd=gTuV3&$blvlv&Y+T0-Cve#!~3ZDPgwk( zK%vg?Qcf$9m)H;;VW*T39YLp-kgkxUetZv}X&!tJ65_R7bG&VQ8k3V1W;&vE?<0y4 z(EN6JS*l!P(3vB!6Or9GVPkL%BwU(;uE;-`emI5G7;8ajQQ_WSYf%5de{%pO5D>eH zzjhDG89ISrjuhGJkyPVur_AnxDT*XpR8wD*6(zx#{zefAzVc^#I>~7bgfF_8_Ly)4 z!pxLbM}%aXhOEO_wU#@(BS4JX9zq(LaR+RYB3`wQ*e8wMn0d;uNKHiLnmK0PxN*E- zenZpnvMH>y>0yKCVWSf*^@w|6Ipg$v0$!kYePh+^(i+7xgD&6sr(5^H18?t!Ya(*D zOW0Y=jyiWp>aHth@^oud$MR1;&=x}o7da=__&J;QQJ&vzG1Z=QIx*gl#H-mG%uN&UEHmF!86RumO`N0U3K0m? zxCbf*%xp8JA58OeX?~|UnC3_+T~iSf>dx@#!iV%ltfauR8j!#lo5uUy$?ne!@87@N9`c)9!IEk89ZYrl63LfG%s_P`DO)pzaDJL z_NYQ~0c5Mj|DS zd-^kWO8)*r$F5lpg1y_OkP_~Yz>DqgQd|rpant-=clOEMiFB95*Kdddx5sKn_+YvNC~KwUrh$epzo`J&aqrfDOMoBbfvI5EF|aFjf( zlk7X|`JE*J(3>a^#ucL&jK()_N&$f(5>PoB4Fi)4vI}Vi-5nW95F(vhhPzr4AtU_;Kn6Q?$FSM7!cd@=py z`in=8vk7PNe| zF{Y(o4_Gb690UNd2r}H6`sUDpYVjFM+Ib%8;iyL%hOGd7OP!wa-c2Y5w9cc%B&^Es z!KWPl&6MUw^g7;k?z-(=Y=7#8>?)2qv&ljNs?YSyS@TDsoCtnY?be1{d}|kwDuor9 zC4kB3c2Op1P`$U-ofq%xu?7I8Q%OS5ui~lfVmtTeTNo% z|5>^JS&ILS@BQyZS*4<>iUS1uWEl1JQXRqy(euz_=Yk4TWlU@SVcrtPCTG=vzR0j`i)yFvBaTig+AV68=>5@5QrxB};DjhkhcniB4G`z^AOq<9wMAyQ9i&tWNwdG$2=@`ad5A8jVSJ*2VNyy*jC9aWqcLp zE%g>7RP=_n}JgL{|Oyb1UVe8~5u)&!3 z#IBLA?3U5lYc}c#69?4Ix&X~_v9KCak*}j7UE?sXt0E}~qc}ba{qjRmeDlMX666QF zzDf^*W`~y!mkOll=Zd(#HAi0ll!nH_u)=c2z1jB!z-nKQh8p-+FSQ+@1ixdaJxI8U z6-_vFmY=x1jxvsSSY-a;j^e&ip;(zR;^==GaZ7qcKLy8NIrA!{>nACkXHiTc`9u|x z<)bfrsXL#x^lV+pA(ck(ux{Orzd?$0YIaj;a2tzqa{LC_w2)fZwovqkfj3Zxc0y@% z6R=Xd{&*(n;dnwj{a$U^(q0P0m+IPvkWP}q;c}jx6}qvmEgm_f0hOHHb4D>C@gsL$ zhXCTvr#@=$pITs_sJ(8Bvo9F(&?{wZ$ZAgzXB>E5srk-5#sGTwjh1Q<+FcmJuU^cp zuU3{hyIdn3fzQd)*y69|-Po{i2%FWuz5aYHRDa0#aKRUL5g-?Kg~AaaU3EO*1#+Fk z{bXh@8TDzI?LiqH#We(RFM!weFG8Kp3gn%IgBnVIva@${toKEv~ z59Y){bw|9w6rm+X(Hk4Y)n5_q6G=b0Krb8i4Uni22}OiX)5#q5sr9ksLqyJo=z(3f zUGJ}6?;ktfd|^9vuWuH**0x>rcT5g*44eeBx7i_K^KBWN*`pGt$POf{AGVf&t$Tu% zV*kp+RnV+3b}O0Dl{}AT^XqlA`(L4qBNF%=260JrngI2+z3jEub<~@W>ler^xCs=PB}V;K;dSA_9*)C+5}tsUJYQLYGE8}7 zk9Q?|WS1BKc(5dg3Al0&tV_lKNin1ont9Q|n4gGXdF#lb0a4af(AMviA9n)6L&&!Q zp`Iy>(PiIohJ#@mQp4^}IP?&|r{qg+4N{AnnU!^GAvLDBy%xifOYo*WFW52Us^^Q} z7omd}b&V_aRJUEPzKkuEfhNia843jF-o~gRpZQF5j|q($Hn$4Fy1&Dk?Ef4G$J5Tb zcgmjqHG3h&uXFYu9!*xk>b#Gja$m+!G4qmM#7=3b%>-A$Xu5uc<=*-0eDWHtEvJ@e zz0p=5s-YfYJga}aEF9j_e%57?_b)RQ1-KX-7VxQ<0-p*{FZtJ@=bxU+U#6ERd1=Z1 zpGe-b3xjhtlJ1rH-&rtj$9sN~jq%DiME!w8wROK*{#hFAk<-&L~`yRXFZu;5kf? zXU$+>fi7BUYdFO#WbLZX8Vo@bUR6am2vaaS>hYwwgS79q;I7P4NZjY#mSt>u!6a*& z_JG#ftX2yeJD<#`3A*rw?VE7f3B-7gq-t1J%J^xf=bTO>fJ&2bzFcX1&5Db|Qmd=9 zmM$@*f?%ii+j8&g(17R7U+f4Q&u2mVffFLz|0JsXZA$#7|F7&nm3o$nrYkD23zNgA zF=MTun9Vw1!W2SV&uRSB;HPY{pcAvC5)LwFEDoHNN|kC24SzhP+ZtfoAAquht{l~% z&GEW2eG;6zlqyaTCy%2g@G!|4`*?7D_;@h?cza#k1nKa*G+6S7z_J}c>J#8<-ZkLD zuoqXejo5a;z1)((Rm}_67Z;(8=4Qsa9HspINB&*|Bbm0+QoaLocM&Nei89<^2u)BN zZZWup3{VfJDIy$Tm29<6olNE=qoZhBx*T4Gv#dUWpY(^f0yDf^yN(&!^VD^yTv3n) zqrRcJ2otto=qRsLC9ggo{k(0JjMMri3!81uAx*TIxjL#S*p#~_$uapNHZJySpJeFq zfR?d%6Gs9eO}uU|BUKT^x=u3v+VE5(%yK}{0X$6x)7@EXTYWypZGwkJj6nb*z;E;u~7)kZNQE4tJ1k8D%a>ZzdRlq@()U0?4dak+ge z`t;hU|FZ2gB1u-M{??(ctM_Om%yyFwBn&kv&4fRHuhLS1t<+$hzqvA?52X|>4DYeg zQU7vGxXlR&2`D`slM8U=(f@WJ?F+V|@Wra9YGVP-wk!p1!c}NmJa<7mQ|9SKHScs; z<24%mzP=h#rVzW3V#c2Gp05^HeJUNDsw8V#`1TH51|C`o0?Ixxzebq7Bsm33xL4*Z z-d?en=1jR(6z+?`esjR1z33nm4Dav6fEYVf0aZf=Bd^LWRIkyQ`CN*7#(@MYA}EO0 zTHRg_uVTVLv;>c`hiq*XJ4jP>+)|sl4H+A+XnP3VEy?ZIq=1_1r~q5xqxC5XCA{mj zB1?@)m*4c=BCE@(Y|bj&+^*Me=E;;#)ncJ17qG+Ji%A=gjN}0oO6<-&RqF|2%x%zMERQ`Wm+qo~bUZ)Hm0w+$h-^ zV$E!T^1eHJtc!%N72HQa|M>ZQN;JI^yWa{WAI%k(BShgb9caDR30tt|1Xuu<<(@({ z&;BNy*$sG@Wg5uBWRUVP3QnO1V_%TLCBE%%ME9wn676{Hlscu9FK-!jAfL2Cn!{&@ zs+U0-*x{uxLpKV<$%SDYY*Muwhj0(nnTcQi(j5OEk;tvmwTMQv;jGN2cR+Sf0_dYNAd%0kdTBw&6+e| zUH02UEd{6K(7=UzQGdIX(wKvZ-`ml0`-Pw=YPH+(-trNcY@EKkfej;td=(T5I|YaCB01Hu%Sn|4!H(P&t)Bl}GxRY_6@P zkwf~iflTGEvxFhkL#!c3tDqs41pY~5Tm@^KVug8)?gg^>1r`2B*mX`=%#Pr*-*w5&89AWrfQN$773T@{;Q9wuoPNF8T29HPI5%0RrsyBH~s#6Y{_ z9|{f4Dnj&pT&?1Xv+4cxZv}WeJl&vwu?Mx-cac6Z{zfW4#0^YjavAU7EVvGb zR#}F-xqF)Sm-GSuL%UN(z?6#4a5%)B&2ZOh9H_rGABXu;Y;$%(k@)k`{0Cq4Hm9pq z98eD&5UjWrSn}P#c_C4eX-+yx^Fjqcrw)j7Y*OZ7;9x6uL09C#pEVE9Yj}iC`sIl} zPYpH{dLlJ)IIr-X8KdL}UUdNjWai{rU1NSnsnux^5QpG##X(>?2@fObK(PNVMOH|{2?j%0WDllPiA;i-Ud{FkwoX-_{0 zFt1$XL;s#boQYGJm5J#M!8w9xuK=WIp~vm#pPr!Fjm-{t8Ny#O0%Imf#Oeu;hw)SF z(Q7%ujrj?#Zf~KxSx^ww^T$xP_`2N^~*s}o1s-4ci0u9KLrhX{luFOvY=!FmFLS=z>*-42-)4NEH`!lO z9RB?Q^dBF}zt5zOfB!I6C0WbP0u>&gEjXt~kT{f~Q?LO)VH5N6Lm800zK#f?8X@bX zYBh6~uU8$10|Q)sJqe&B38C`&5sbRosEQhE!VEGW^Bk@@`W|L_PFeeYygYpQi7bh& zBxNCHSe`SG`6%0m|AO zcj^XW>vh5Bo5tUAB3*NSFp;XR{pfX^scqKWZ0<1iS|u9O8>zA@8RyYF$zwRaT!IIj zb*6Of^SJM>R>z){BPF-&T#57(&vRpQpfHK`;Y3uIRNgv&_^fI?wjHuX!3ic5slL&$ z;n7+gv|ldgH#0X4#BS+GlP|K4{5cH&DlotT@GoAAlt|#6ubuZ_BU14~wzg{fv`O_H zM7OMdQj|WZflKC^#~`4?79Vhiq_4!^P2C+C$VE@=Q>J9oT$v;emddN26)j zI$^4UktPhO{@flXOvj843l~v$2Y;>6dMOk#i*w9MX1JzgPZc4&W|GPwkH{#MWAuu3 zAiII*6u9e}q@RB-^eao1XfkG7utet*5gyfgz*oA3hIU;~r;2y!mPhAcvU+}>L{7xN zE7g4Xfgq7bSOF1j+0^KmNxXjffcUmVt+fJnzgz6|yxu-|7FzBsM;Sf+PaRWp?vzBn zpI=hUsQ-j|rGNNCn&iI!CHPaZnDzJs*onM=(Iwpf-{tlnok+mg#MS|rV)AcWk+mYK zDw>Z?y`6o7nHYRhvsocOAzcv24{qOR4Yc_pp)dX$RhB9DeanJ`W*DQj@ zVDl#DEZsZ7J91X`FC0O7fB0yocL&``?+cD8?}xR9#~NT$g8zvPBo+OhVX$Ci>{Htr z9*M1`CW(*))fz;Pmi=uMY^dDBn?$txW2lKp>#&t*mz+0&A<{XzBNB;~9R{}r3-bK( zPQ)o%pV(GoUTI#T#ZseOVOG)7q_Y}()qVYsO@)eJgF}$c0{nW{xSjV3&IfrPgRSe9 z15*avOnO@tLnaa+%A~VW-F40(iaM`DUEVUIyePtbj1syXZd>_0&)j^`sX`w!V?S9I za=%#LY(YcXnwdF(#yvjr!AXb$Ug;s1=l3x$Y=5men)Q4=tgO{KGkcfbH~S$QYK_K` z#RaF2xR=iK@-h(?yW07I9gNge7XSx&b+8K}}4%(rmUJ`W7T!VTuil+r>7(JuNX z!D}!w`cl1=8;7m^vE1>I2DjP}8Bg)MR1joV3_=~GN_L2kSd7_m7uYfIw`J2LSh9GH zgdGhDO_o%1lp7aH_*NaT%!`EUMOs5M9OKGH2Ir^+?dbSm_eC`Z z4xUu}!|OxU^jnYI3-7-mFt2#>KNY>$ZJ(d;^98NNQpqYyuF4+e20s_*+O?~09DA7U zv=RdDyTawVQzTTV(5t3HX(y)lHI8<9r&{aMn{_1D6>>s%+NOR6SC%is9deqtr`>qi zmYB!zi_oW@h4f-T9b+w(Tp)HTxkD9|G>AM_m|sbgEA@V7IsGvbf82Y!u`SV5;oLf; zgM69OLfMbs4SDI?^GRm2L#czD2c?|4p-=q{Z9hxI=Sirkqh$; z1$U*td8HK~t0Unc?-c2J?2vwBW}luwnx`IAM?kg0f_8!Ca0%Xss6coZPEpI~0(_T3 zwPr}qi$espA_9Qpd1vm48(=6Pk*c>lw}MrP%{hwFG?y&o+Vvk~(KBGqAoMfHo-mm< zZXJ<{M6h3a#lS|#M6e6K|1fur&+ac7K`HW4K$+U7-nsiBBOkMc^xM%Leup7*fTl0F z>{IJz8}wdR^2YaHVax7j=yD!l<6HpVuZa9#&JaO;M`LjtM`IgDb0=UVk|I!hW@8GR zYVGuayu<&@t1ePpwVC~i#B-{(1{nfqgqKs&kjQP5XY=N#lm{0Q2uA}|DDSe3k6IqB zqgpL{LjNG5>p%;G`px7U)H=DMf+S5SMmaip_B5Wxv3p%|dC3P-x=Z;5ZvakZF0PNq zd2O+-rjHB{9ZwmL1>mH}$!NwvDzT3WFj~cf0W?)R{k|P(rRy-? zyfm13MmJzCb8(5dTxu%I?aQ@PxvE+!m1}N1oRQr?52)0a5PB?!lrp$Vp!;gn&Gl#3 z_~sG`KO9a38p9b)4o1I62lkN7kb{51G7@nlwzvQaKG+mY$mBBrW~wb0-l(Qec3G7 z_G#r-+ZgJ5Dn5Ua!r5wZbZ*7npws|lzet^Ip0f~ja9CC*vM;4S3FuzQ z&c5pL;$QDhgIHXtfyC@WZ@4r1X}g7E*$lX#1G%`L-TTqf$xZAD5j7SXxP<9F)CS1ZtJ{YHy51)&5(j+R+3pAtZcQYQLJQ`x}~bPa6u4^?}Sd0|8A$C zLMTgxn#x5>w`w)7WEIF%F`6M0&zAi{ED%$zGPf|@+420&+AnI@9+*3VH$Yy5weeFbn9%hqjxxIo<9 z-QC^Y-QC@VxVyV2#E82<+?}|)8^jaB`?%-cKj-9d&*gR16q71?t^RuUOn2|@y|y!M zsr!b`q17C*DbKd{Om3Kc89pL|B1Hj)^MEq8yg(SXxREE;O0)smC%q+SCh@HH$nVFi zIT3GINvm3f-j#5*Uq{uce$c7rZ!elG?){>=&({qtM5Egx-Gzr1Y$qrTd}M?v6dd6) zfw!UMyTgWeHbEI)Gc=0HUgP4EU|3i?eil0$Vn-G=N6?mI*b*C#6NS<##mKMlIuI ztM8~Ba;K<-5;$k{n9uAM*y`54BE(?1aNb?+*7JutQ$QhCMM%5M6Ud6WPOk?D5=$#Kt$u~x748Dt-neLR##ka=R z(`{Amhz?(?0ue{KQn`Cy3-h+U6T>7p1PB}n-{9drFR}ptFEhS z&7X#8@x3e6(>##GKF5;C^pqoitzs1YnKTmtiz&Y;Z8T|O8{HSDid9~VBcf*O$J0(J z8BQT>#D!MYW?4v;K##iH;~I|{I%;=KsPtPqWQU%{1Wz7WaG##kGI-Xq0l(&sw# zZ(O@kZeOUS{_Q7IXD0&bAODTfL-c84V;<(agMlPtjr>zk%mM| z`qh9LLdW9egpLKHlBDU5Sl|7D>P%KUEPzsA|q_j3KZg(>!dJEZq_t-UwU{h5W)q7)@ zrrA-d`P6RQkTwfaZzyb3Yt9i3xiqRAvbM=eqc?2Y)K;!cy$kxWD2h*+bf}bw z@(f#mZRs6uV<&7GE7OpPDB8yp<_5{TFq;KOdU>aY=Jw9Q!pn2o-S&FYmC3!NBlSFN z+_PbK)fxFS$`*HdvIEc`O-6CV?dw=VgUV|cT-tTbA5iAF#H=ZrrGiM4of6lolcD{i z_IWLx`5b+(=e{Qp%wpQ1lF!hsfvwn|VHGj(F2Y$6M+-)pkMA;XHjM%Wv3S9>H_8m^ zL<|J8IZ@C_X7&W~>9{!WG~CV0htoTc7%N|Oe}gmSYgQw3fmI{HX!&&Znj-QZPVH8}U zQ?ct7n(Fx5$K0r(k(wfPLhEFggnt+9DL-D|^kTCJ@;(jA_JJo#;NWelk zHnpIt8|6UQnT(h;>4d$7=g1ade#ehcZ9|m>TK~nv3bUej()JaK*IO&G0XN|bvNzDX zKDdiLyn00tCl7GTBsj?s&>Bshu*HO#1>l1!v~YfBK@h}9DfSUK06E=Zx&=RC4K`z2 zD#1iAExe#Qi>+e?&@3G!ZvBEIGntcZ4mT!{G#n=aUy$RY)rYAzcZd zh%~p9*`}T?`oMKC~9lbU#vec921HJZv-h@g|P|!v2kD*xTJ38(#y-{c8@GKP)6bAJ=Ix zDRAyGrQ;JAHIAK-qaqCdTxWdd(aR5!e= zOMG8>fb65dFo^Jk7oigPNzwXw>Z`h8}u!+%#t6w;gMI z29pPMc59lh-fI=!(rh%iHF%l3SLhdoIK?h)Al6SSebD4An%}l+F%Z z{gG3Gd%6!GGxAwRxz%C?s&5Sthh?M82eQD}W#kF?Gf-%;X)EJs*Hve+<7;8~Zj&F8a-Y!0wJg{<~WGT}06om4OCa1G&C9zk+#^YDxp4&)Ea2iPgjcCi`l8%r`8k zn{H0YeB^8o#NE7sOS{gs)g~=A5nSPn0!YQis;xo8z1)i8PaLOohR$!jPUne=?M$13 z&YGZ0YOK<&2kAM-348Q=?T*w}n69Z5%G5LoEW4|2gi_{$j#8~p>A`l0=hQhMFUfsC z_|{8A2)@wUu~Rh<(4w8#zS7C5Wo|l0FU3R^2{J}=)+)QFZai|=B^Xfb7;UO`(Vg{d zSIAE?Drd+EjHZ;3L$L~N&o&v*0vnys*l}7qPtUVX^db6k*kI^G}sj~_Vt;W#R zc;Q-dX^WeOp2I*!5LX^mBy>YtaR!)rSoZPk;Kz|J-yW)POMMh5n>*zPC#UImeiKfZ zBV|?wvP@pzhiZW-q4Q5JsKV_b_cs}z6t6uC)7u|DADHhMYPawLJb7O}7>!J8lxJH{ z0JXm%>ggGnv<`7buW)RRN#PbcCV-%Wo~{)kU0{ib$$$hx?Uf3#5T%05ljayyFn@#GSBOB`k1}}=N3wZ_YRp61>)nt?4Kkvqh_}*p zqD(y8BoKG*`Mxy;ca4mFo-3|k1lh=iXT&;?vM2oVa)j;P_`t{S%LS5%Bv>c?W-^qR zvRP!{mEOt`12Pabz0^7$cC6Mm(Yf1)3MX_H)69ajLOI+@%0ZB@L_#TF^w>ff=~vOQ z-(mhb5@ZrM))fQJfEE2+R_WJ!Lw~##e;Wi6<+XmwDsk1S)jCT_)unB^M34!SStIHY z;+yg!`a#BW-ZF~?oeUT&8ZaR8Bko94p> z?);V^j#&0?&vMc)yTZ_;&2PC9&~{fZOO$SiB|aft83?KScgO~9P>cn4X6S zb!=hILpY@H%?bo=nBFVVB5G^3oN$Iw!`wNcC!-F_$h$_0?PM~vWG{Go1%iOzp+heuVm*awP~V`>x+Ah`8^q?0+XzLS z#nx`SO4p6hYVC8*rIK0G5|(+d7^7<1ae6p4HXDJR-6mOtOM6GQVsP3DVv@v9HXzXN zTh!>aLI+lIjlV6WekYLbT!F-6sv7xzPHU;OIZEj&UFvj3D7=vq`~=qrUFJ1C42Szc z09CS&+K$vAgC?mnLR!>gL**vi8`M=zQ4ZyB^mdb?;}Q99|M&(%lYc6%D> zMXk?t5zV+Dl~z2o@{M}$gycp$E2bd9VyWou59o`g^s|HN!G5z>>qWo{SJg-5(7EsZ zxHWsi+pj=*)D#Kkb{g42n1FxxIJ;-~t*Jw#Sq&p5)sC~9rFZR!)q*2!;`s0O`VRMoQ zhd02;l>kQm|1sD7weLPtaU38SfcRwWycAd%7$%EEg|BQ%R)Yx3FCJ15Di$v+NlWOC zF;oDp<~(?sbX)m(FdfX};&mu-U#(BV#b`sGd|hAn*aO{~$5}dy&Gk`ZboQ%+YI6hF zT4u|3RZ`WIT0MPjnrJG@eXF>rKp`ljpzWZqigkm!h+(bJ#xrZl&;(99gL@VETxe~G z9@K8aN8SQWt@yHwr|hHqyn)aQCtIR-tI~+1m1MTu@x5EMMc&loOqMxMys}uemRGmuwquV%#WDFVT`1`BQw|!a zi{dnboCJ>7mP~+ptbJzo_r-m#Q{uuJmq+D^nDK;;R!f;?5Ud1#$OFWrYW)p}?&%K9 zGW-N4ngs0+_)hp9!Ry{Q0UuctyI51*-ITm3dg?C zLCGoR19=V{tJ8|6<*&p9(saX2!n1}bt+f_QFxx>!U$B%S zuQ%@uJh7wo+5FQ9Nd|aA@P)!809 zJk@Yqs$&GS@J7p|3mYNER6P$oEK6?p4UU83s##ygEKEs8|#5n=4T5u)=QQZzp`kP*+WcKaJJ)Mm>?ZmUvv zvJ+aMj4K-ev$6)97UKCGvr@9Q_=jDkcBNtYpA!VGK|(!xUU1lpz!1_wSn!Qp{1E)Y zLM24?z#82-LWQk;!=NnMLawmW~ZO zLMAIqoGLoy-c3)U*4{>Jsvpx*IQG|__b`tWeIs+c*YIu1yJ;si>U(kqRe~*iO4gdu z{;HR@wtb|ySRsd?W^4A>AhBgx$-Nk-bj ztO*q_aZC95lEd_%g{yNmiIMZ0dTDRQr#oq95SM_yOyee5i5T8*Fr$R&F|L?11f{{e z5+I>LKC||q*4a}Iy#5~9SO03Jnu1Ocr|a##YETR!OsOJuByE^XL%&!>NjaZ{Qfl{GjY8s*k(h1hj zoOGK(J9vi_I~}$Q<3ICw+Lortdc;PAKZU2Dp1n7YweLZKuuA^2C}fHwXa5y1A76D| zre~qDB@SLm`B0RG8cY+T0QVp~g*gd}2WW{+eg+JOM`5%?38_1g7qD`ClW8FOz#gvD zcNP&qmrWHe{k0o0)BxFB_0eE#lTpbnloMXx(%6ox{PD$EyEaW5wKTwPY$f2NFY#}@ zJ%7xiGu7O56=#}%c%|-0TT|l!zm9+u1mqzDBI2KihGi0ejSAe2ze>n5_?Z^LgqUCR zP`j*tu?4w&X3D&DW|j%BXsTnjf?MN3`yuPhY4Vz?qqnd^%d$dd^=z4gAytf;_&R#o z;goIdCe!Bo%9*70(|&3`5b|(*^SpoKmo2L+SCM`=N>RV z1Kl_mBv|aLbFtw(7PsM1o}MwmpEkQWA91+lqYctxHq~R_Z||p2V@tKM8;8>1dS87k z5#g2FKHNv)!gVw6m5nAdC*r|XC<#XdHcTT9WEa1nmPtBD8<~&`a(N@)BWGONPuWYS z!R06Z8AALt^w2JDYI-+4p2Wcj8|PLwULVWJzJ~al6JWD%0*x+hOm^72PW#2h6WJgyR_;>&QA`ZetkKhG9u-7Y&n$0o%pe3o{=K8Z%0a zO+dCScQT2!#$p|u7H~&jndK5k1Y3SFinn|_;AUQ{6i@XUJfcXnC#(W0{h|p8Wn_6C z5Q0fi5voc$)lS_~ITw){YAPB34dmNws$Cfwd?WsaEWTqXQtwdNA)9b7RNcGu< zKB`KkPLJ5KwtQl9{Cp_cB9ZgRw4yy8hT>9`{NXrc!RAQ7u9nMkGW01iSCq6`eVvTL zB%%E%FEeQ>o235o#G+AO12H$pR-mpM+J?yh?OIV%B!c zepip-e(|aWc7|r;1$! z4VdmEBt#-?C-t{bnG!%%Tht656Zcv4=|dN@SPHR99-(Tisj?HGAJyrX;M*%Fs<+dX z4ZjsKFT@q7fXQu|`cgZ0NMfm}AN1h*VLXgb|FC@$Exd-Vu18y0bFw2qoL2=#&G%9N zxYn0LqbIe*XlmPpOlrqd&)q-YB-@R*O1B(LYr4@eg0CM>W5YOT39K{G~b{q1x+RAn9@~%hrKx1ebqqh{i!u_uA^* zOrbu#$1&*O9`*0@d7ueYOgVqAn@KZi;I>?AJ0WDjGRqBjpECmAWZXv3Ne6SVi z=SQ21`(&rqQtr^+j5nq=b1_xN421Y{U4!$m=u;FZ(l zRL+`gXFiGx+;8g(P{)1`!i@12piUeP!7#Ge+z|^?VnPbiq*fu#lR>jD)D*I;yP0WN z?A^12@<`iOzxtR4Y3u`PUg%!mr%H*=ux(y=S$@$A2kBDU0=MWCscA9bWZ#aLtsK?F zN6oO!V4si2GN=^fiQI^0U+XCyuL0exB!+?U*-p%AU~dQNxK2}7o@mge_H`SPu^M!h z?gimP!Q?~W*Hf!QyH-4xflM-v_<6Ji3nyZRm>o8;4Femdpk*Q#lhi5L@YL^+sZ4kH z2>GS+pLsU2Vc0%kx{99CZA;iU65pWTR(meQJoHr+cP_>}DD}BXY!$|q_c-KC#8irY ziRu2Tge`9_a$q4@;A&T`PrLm}$%0{pPbMA=={t~zZ-jD4&a73?g2MI577N|VSxv8< zB#pKzx{fMl7)ts^ijng*ipy6GjB0j^1Y{i*Ywv-WU?rw6l?(*2rg`(n$COdV=V{xK z1b|yXe z8U?b7Lq|MKOWC^(o7^?yt#tin?Q&(u@&ZRFvcV?DOiyxG@3mRrR=sXGy!fgXgtywR z(Xts-eRUjA|X@gv3^-T#$#6CugU~NFw>U(meX)C+pUh4?4>x zL0bmk@*DVk)2x->Pq-&igr_R1{~o7vrVn%u@BboKX;-k}N(Py+ghm z>`sV3!J$T$+SKOUeX0z^&zybb#CJVaK#a6S>@w|$A$V*LU+x4oO2WlKbEg!VUG_2B zd%EL$^^=wnPH}c#3NLl81F@<|}09>75Ofl;a6 z{4%)*tOiTuQCM|&ho8!1OgwIzUwTDRYY8K9u=Q6e(XKA zIR231bbO#5TB%&nJ@hrUd-a&M!Zvm}BaVehAnl$7jIMAxELdOJVC3X5b&w18&Q^ZT{n)@<0+Bz4Vf!7wgg;Xm8)0cCBDm?h-xVmL#?* zVLGtxDl209GKYLNFyr%1FPTK9oyHS~l&uwL3VzVpTpqsAe!AEl%P0HdfHFFgk9r1f zza*T~sKgnVp|=eYqzkPl{tf)=5_zd1xPk_Gu-xY(KbC#0KE_TyH=$8TkhR`RcO9n* zmJl?soynZaDpOd7cX_(NwTp;H$4Rf6lZQL`GHhWntVvth`zoObsTlMjQre>7`xlhN(O zLyT<+_!1n$;wK-pm2eglD0t;<5y*CVBS|!z%{e*ymPcyngL?GC42rX~mZ<=#T z(JbNjNQ^RlJW*_-3m_Uzq?!>qYRh8RiLD&)NFh?&){sA|6rY(bVMFaRW1Dx*jJ|tt zpP@~HR4>J%?JPeeO!`6=P=elb@TPyY9CdW??vi;w8OV!1`L;g90L!2%m2R~!#mWRa zv4aDxvU%hU2{}81TgdGm-h9#q_(5ArkbK`BE!DDQm>y?$y;6!n|A>KvsNSA*#QZ#( z?ye8U_!L8lC>w={6^VDS_!9PoWdUbi$)hds@FIC|RmQoRjH=e8Frp?~fD+Y=nI~4C zd5b=<#eNIJVf#!2%VDUVm`_`tu~_ge79EWEh+ zvNR$*broFsqjsEc{;yaf(E3slncutRF9~fmMsuM;BW5`Pn|wnoohaz(c+aVEjb|FT zXWNM}0(02SI+wqXLWlPySl_=!&1_F)P}hP*Wi)QlOo%&Bre0)1bI-t?G%4wVvfV5x zatNw>-mrElI9pYzY2kr#%;MXJNM*hw+=hvq9VIf4v0^eI;P#5ZCCq$JwQZ}_0>R*m z`BBMkC~TSH^+HL?Dpv=!4!$I7ws02+1$_jGS;J6a)w~BaJ(p_HQ-f4Yqpt4}2UikB zL+O&)E=^xwP45tR$~byv$J}NhuDh|p&_KUd5o+1+C5>KO;e<{_DQ^yB@;KDNGRNmXy!Q+Z-qUc{_q*{I$9X`%sl zPi$hZ_^Zw!l*hHhy>e%-y7(Ot)dbm|6TTzp{?et5tz*uU3h=_Ktc~}U@3`{Ixz!gm zogC|n$27Jx9Z(<2!rCMby_jq6c|9qc#h&ZNb!!*vSrO=#Qb;?%9dgCbK_uRJm{pa=k#^ElqFaR+X6R z_H4ZaVNS5`@8mHS+qX0I_v({Jt;Nt6qlSWtv ztoL)@2$2zkqIK8etFRlF-cO!A$``p|nfx%wzWlUbuV+o3YZ+ak`ldhJ4KB zuCqFNizuNwd+U|`wL{yNvMu_kWCt(gehOCau&u=9@jX|h{xUZ0tcO!s^My#k^u0F_5(aTzwqw-%fW8=ry%El?~$r3_+S81z6vi5ObJ#i z^+&A`D^0T|8LdD9Nmd@#2DIu;77#7p)ta0Te*iu8wmdHU8e!X;|37-v+n;R#& zc-;ZpA5PzqvR+L?G!d0-=*i}5jcVs9)TR@)g>>PqWZFh7?adTgxlyC)tp(&M(063l z7R&ptBef^pRbt;$g0q7P+h*`KD&WL;0g$8H-q3Bf!7+azvn2d5j$O6>YHGbs9Xob{ zz6=Fs=A(LAKzyW*$cm8|QB(U%#by73`Z$w__b~B}>fe;RMa!im4ExDQY zlu;3IY)TDvVaD^P%7v4+<;Ds-oqd@={%>OnsnR6WJHf=wR4gU18pCFUHXZWo-vMT}8d?_tY-Au|BGk9pphj_fZK)#*pCF+G z(9VhMDky=<^N+`Iq*uO(F;e*eep=?-Y%Z~H&Td;!nhcpHT2ZbNb)X!mKE)QhkaPZ; z!qIWK#rLU!@^xgobLSa2`Fn4s5h=GHk$>`nV#z@SF7KxH)t_E zk0QSP-em?7e8CK%MRL%juC^YSrwjCu&TV^6(Ps0Glr`WD{HfXxc5Ai68eG**k#jjT z6{I$Q7b8!V&YN>D5T4KPhzw76Sr{6alo21nd6F&=n0tgzjUE*{$Il%gz}oFtGY(3& z86r_)TjyLgLfb(cO zdKB&?p(|c*yu}i6TZzyuMx2o!Ez4KgWr_~Y{3w&Unk8=2M|&d4*ZO%M>OrWFdZ4Lj zon0BJEw~u*5xZ=3o0*OTF9XRb);dcrqr1hWzFHAIt>|<}g5}I!)&71YMguIf0*fv~ zXp7b*lu*zw^JqM)0aW00Ji-bF1I9v`D3W#h!L|Xd&5dNje;#C7T``mnaiT%Sn|9!S zG%sm5O->cZGt%GkTNx3z4SGXq_`VBp4=%XnyR-u6Hq!lh6h~6h5yh?fEjMY(4cA;+ zZE`tV37mK5D&{0Uf+8`7*7!=|c}896w>{`WA85n1s;V()Hoe;dptXs`@;U7?UM+}j=tbZK6;FnXoYOt^ zrx0zjM#0*|-6FUqIAeG9XIA3zy^7jIT^Egp6Y7E(f?PWtE0Ea~6VJf(jN|w8Qx1^! zX(6~KaU2VDh>++A%&c{Q!z0F`BkyT~{qg>z#oGw*DXzsW*3-1Zn`Q7&yIo_59~&Hi zJU2`G#Em!7B7K@q!32I>!3zTXUsEDa-N8aV?>o}xotU#%Pug1YoXXDUhcZ9y*=#;p zaIZXM4($tIvJvhJB_So7RA3oSbQ5}II5}q^O52;HF%fej1DjNXMJt5WObKJs6LcwL zk4zV+#-QyDPD}EK?Dt;)n?cRNQPz#!0%sTY@EyZ>`f=d%Sv5bU4`d)6)8B*ft6rH& zvO;!cieUD$FTd$Puo}5R-5|_(0GfBDJtowXSp~Tkc{|8WlLkI_9+LE~RXLK+&WPVfsg5&1|_ za;b*GP}*e6fa&nedI~`OZ3H;ff-GIqSE%58AjgS2ZgWD#V+6gf0UPPZ)P;y*o~fB^ z51D74Yitaket7hbD?o zH`_G@n;l_bknkQOmUb$9MK#0MDXU)tN>l=ls3`VJAiMRohc_UNTfCF~Y6mF=D&3>1 zB6jEt3B|kMwbl3-b>x(|uxEQ%&{==*oBlv*csm9^xp7`gN`6sgT@Z4}UDX;Wx2k_EA)VFfd|d>zv= zxKP?YtEbHzQAACe+YT$xCh$bZMa7rH3_eN7*atV~>YGnufRvQ3*qc8#$6%qhem?Xw zoT3fT19?+yu7VkSA~A@5A3I}CkCXIVlZq?r;f1iKZ;Os{|R zxdj;+cqGq#2u>c03OWs;SOsapkZkP3O~F0-U6*Lt zr7-%Lmni0E-}aaAV?Ni{Qg;=G zGgFBt{3fy=x$fjbu^U6oM$jRPgYk86h0)j(&Cx`lPo9(l<8nRD@6CtmcZQD!$$fWk zBNrMv*>DnH?)-=IF~-$1Mt{6PVc<`q|;g-5Q{_7|`!1ou<-$D;R%<|J>Ii4qWIL8IU=q5`8Z$%A!5 zKkT&gT+N2Cli~++`Ys0O`-sm(UPGW@eXN)dbNp(2q)jey(=>wxxmI5UqpGxej;`E} z6_LMeMvG17GhhMJ)#>v#(w5af(*;budW}_)*5s529ZmL9uV^ei)hZ!k?1aldYeWDN zM4=YJ0Sl@Kx%gFnID#j{Fr8-f#-;k99VnHTz_iZ3`0KPRq2bVd^VeyqLKF}m?p#Pp zu3p4B#RGAq{(Pp7fUg_d-=FEr?TUX@&d3-e&NPmn)z2xk`{ zS7ns$DbJ{S|5+{@YN-wci^Ej?Ed!Vy?qoZ{vIrg;sMcxA7Yvbb=VlfK{4j*qOc+M` zkTza}O(Hpyvk%dZ!cxKR4Qw%fZVfdJ-l`s?WDd5Hx-3T2RlpL;lrXo7s;+~1VOO6L zj0HgybAW_i7l`Cw_Q>|DAo^~-61Vzj>RnUOhr`ImcVg~ZQ9oG)Q!(w(ZF)TdWAY_6 z&l;BXv7f1ANh^n1*cb6j+$V=BFt)38x#8ELV|kl3=&9rgi4G4myje;n5aQ&!2Gwtk zkSHAdhbZVeAZLJ232loyF6-Vif67gzaijtnrOe|fF$Mffou>|2%58D1{sZ{0i_mvJ zx>XPXj}jhm{Y=jMZz*)ZaqWMWLEm{Pehv-}4yeutxSk6t;8x$s%+ip`-pIhn%+~SG zg6a}f;O|$j5rF{h`x7|8_Wo4> zqF^tIl#n7Hm6)_J&C6<^EDVKzwoDmt{rs`d<)>2V|5cOXlNJ*eQc$Fp5`KyBv&Mgj z0Vm}CR5AefHuffe8uO>}8F2rz#=j-u|B32nA3T>M!0n$Z{#&m8Z_H=z z>d9w-M$Q0w=w}+M=YkD*cYguEZ)4;5Q)Av%O3%z15Q_M$EdR1?rhbOT`2f5bz(w$k z3%FAS1j76RS`eTRU}>Xg_#YX%mw-by><;e$-NXxMFXLYTIRT!Le*y%I9IkGBPL8Gk zeP1(!XF-gY3^5mQWAA=yrUJzN@&3Y)3Fx1HVEAJ~_7d)kG|fsb0A>hq(ftMP2<0E) z0PQugH*#>01SF9*vi^^B|4Vr95L!5GKv(VnOy=hy`scC)c$t3DT7a~%rIQ0d9z@v8 z(umK%0Kg!nXRY^t+0;DS^5qmvA21g};l%S}Mm64>4 zjfIo#ue;``+&sPrARNyKXes$~!vS}6`2PU?@3d1tZSU8(d&jB{r2v#Azy$#MQ^5iJ zf?qUQ>_1lbYdq~xe}J|J5D-8|{skTc^{?@)9US#6E&rPhrz9b%K>*&=a=^y~_fM?@ z0*YYzC%j*`uF#FPMH%pbfB>t9pC9DsGA;T`G)Wti|N69F<~e@`GnV)z*l%S$e`!-M zb7()a*h>9xmS1G({#C$pV_)F%|mo0vo>F*icQ|*`N|2EQJt*Ga z8B3lkfBSpo|0Iq0@3X;|@GrAaJi~jN{;h5Qf&ZPA#7m-=O7hP{1Xh0|`cwP=i>~}j z_?MFC&+yIG{{;VHviuVEr4slvESl{b3>9<+_ z9Mk!d;AI5eGeLIh|0lu!>amwGP0v)WfK}UzG44;F_kVxX{%2pk3~qVGAJ6&?{C^I0 zdD(9-V*#GYVDkPq*{>&AFL$7yF^_8hhWW4V`1^kJ%XYr>em`S&xBhR;e;T7+dK90L z2Rr_b{QLgJzx{$2Uan`J%+G)0c{%O;lNtSwVf>}%<(bB|>;I;7|IH8cpEm!;>+)x( k$xpA#bLj+t{Wl+stON*Pt@$(Hj~++|a0&sl`{!T(4=x}9z5oCK diff --git a/samples/chaincodes/chaincode-java-simple/gradle/wrapper/gradle-wrapper.properties b/samples/chaincodes/chaincode-java-simple/gradle/wrapper/gradle-wrapper.properties index 0f80bbf51..c329bbb42 100644 --- a/samples/chaincodes/chaincode-java-simple/gradle/wrapper/gradle-wrapper.properties +++ b/samples/chaincodes/chaincode-java-simple/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=30000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/chaincodes/chaincode-java-simple/gradlew b/samples/chaincodes/chaincode-java-simple/gradlew index cccdd3d51..65dcd68d6 100755 --- a/samples/chaincodes/chaincode-java-simple/gradlew +++ b/samples/chaincodes/chaincode-java-simple/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# 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 +# +# https://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. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/samples/chaincodes/chaincode-java-simple/gradlew.bat b/samples/chaincodes/chaincode-java-simple/gradlew.bat index f9553162f..6689b85be 100644 --- a/samples/chaincodes/chaincode-java-simple/gradlew.bat +++ b/samples/chaincodes/chaincode-java-simple/gradlew.bat @@ -1,84 +1,92 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From 8e4f4acf45ea668c587c27533169389cfeb534b3 Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Mon, 21 Jul 2025 14:19:35 +0300 Subject: [PATCH 456/471] Generate diagrams by default for each 'generate' command (#584) Signed-off-by: Pereowei Daniel --- ...hlf2-1org-1chaincode-k8s.json.test.ts.snap | 26 ++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 24 +++++++ ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 26 ++++++++ ...2chaincodes-private-data.yaml.test.ts.snap | 34 ++++++++++ ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 63 +++++++++++++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 55 ++++++++++++++++ ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 26 ++++++++ ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 26 ++++++++ src/setup-docker/index.ts | 7 +++ src/setup-k8s/index.ts | 7 +++ 10 files changed, 294 insertions(+) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 7cff81ecf..98925532a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -482,6 +482,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -492,5 +517,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/chaincode-functions.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/util.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 81966a0c9..c97954eac 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -3450,6 +3450,29 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - postgres] + Org1_peer0[Peer: peer0] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3478,5 +3501,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index e15dd2f9c..8e5ecbb2c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -3315,6 +3315,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3341,5 +3366,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper fil "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5667f9148..021594c77 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -4245,6 +4245,39 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Org_Org2 [Org: Org2] + CA_ca_Org2[CA: ca_Org2 - sqlite] + Org2_peer0[Peer: peer0] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_or_policy_chaincode[Chaincode: or-policy-chaincode] + Chaincode_and_policy_chaincode[Chaincode: and-policy-chaincode] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 + Org_Org2 -.-> Channel_my_channel1 + Org2_peer0 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -4277,5 +4310,6 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 956466e56..ee92aa0b2 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -5655,6 +5655,68 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; +exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` +"graph TD + + subgraph Org_Orderer1 [Org: Orderer1] + CA_ca_Orderer1[CA: ca_Orderer1 - sqlite] + end + + subgraph Org_Orderer2 [Org: Orderer2] + CA_ca_Orderer2[CA: ca_Orderer2 - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Org_Org2 [Org: Org2] + CA_ca_Org2[CA: ca_Org2 - sqlite] + Org2_peer0[Peer: peer0] + Org2_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + subgraph Channel_my_channel2 [Channel: my-channel2] + Chaincode_chaincode2[Chaincode: chaincode2] + end + + subgraph Channel_my_channel3 [Channel: my-channel3] + end + + %% Connections + Org_Orderer1 --> Channel_my_channel1 + Org_Orderer1 --> Channel_my_channel2 + Org_Orderer1 --> Channel_my_channel3 + Org_Orderer2 --> Channel_my_channel1 + Org_Orderer2 --> Channel_my_channel2 + Org_Orderer2 --> Channel_my_channel3 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 + Org_Org2 -.-> Channel_my_channel1 + Org2_peer0 --> Channel_my_channel1 + Org2_peer1 --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel2 + Org1_peer0 --> Channel_my_channel2 + Org1_peer1 --> Channel_my_channel2 + Org_Org2 -.-> Channel_my_channel2 + Org2_peer0 --> Channel_my_channel2 + Org2_peer1 --> Channel_my_channel2 + Org_Org1 -.-> Channel_my_channel3 + Org1_peer0 --> Channel_my_channel3 + Org1_peer1 --> Channel_my_channel3 + Org_Org2 -.-> Channel_my_channel3 + Org2_peer0 --> Channel_my_channel3 + Org2_peer1 --> Channel_my_channel3 +" +`; + exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -5689,5 +5751,6 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 8996f3c1a..724512188 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -6171,6 +6171,60 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Org_Org2 [Org: Org2] + CA_ca_Org2[CA: ca_Org2 - sqlite] + Org2_peer0[Peer: peer0] + Org2_peer1[Peer: peer1] + end + + subgraph Org_Org3 [Org: Org3] + CA_ca_Org3[CA: ca_Org3 - sqlite] + Org3_peer0[Peer: peer0] + Org3_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + subgraph Channel_my_channel2 [Channel: my-channel2] + end + + subgraph Channel_my_channel3 [Channel: my-channel3] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Orderer --> Channel_my_channel2 + Org_Orderer --> Channel_my_channel3 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 + Org_Org2 -.-> Channel_my_channel2 + Org2_peer0 --> Channel_my_channel2 + Org2_peer1 --> Channel_my_channel2 + Org_Org1 -.-> Channel_my_channel3 + Org1_peer0 --> Channel_my_channel3 + Org1_peer1 --> Channel_my_channel3 + Org_Org2 -.-> Channel_my_channel3 + Org2_peer0 --> Channel_my_channel3 + Org2_peer1 --> Channel_my_channel3 +" +`; + exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -6209,5 +6263,6 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index bf8ce1b43..ff2baf773 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -3564,6 +3564,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3590,5 +3615,6 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper fi "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 0a0e4c2cb..2a9dad77a 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -3588,6 +3588,31 @@ echo "Executing post-generate hook" " `; +exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - sqlite] + Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 +" +`; + exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3614,5 +3639,6 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 081ea4890..47d568fea 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -72,6 +72,13 @@ export default class SetupDockerGenerator extends Generator { // ======= hooks ==================================================================== this._copyHooks(config.hooks); + // generate the diagram by default + const ExportNetworkTopologyPath = require.resolve("../export-network-topology"); + const outputFile = this.destinationPath("network-topology.mmd"); + this.composeWith(ExportNetworkTopologyPath, { + arguments: [fabloConfigPath, outputFile], + }); + this.on("end", () => { console.log("Done & done !!! Try the network out: "); console.log("-> fablo up - to start network"); diff --git a/src/setup-k8s/index.ts b/src/setup-k8s/index.ts index 4c5a9cc87..84d206250 100644 --- a/src/setup-k8s/index.ts +++ b/src/setup-k8s/index.ts @@ -48,6 +48,13 @@ export default class SetupDockerGenerator extends Generator { // ======= hooks ==================================================================== this._copyHooks(config.hooks); + // generate the diagram by default + const ExportNetworkTopologyPath = require.resolve("../export-network-topology"); + const outputFile = this.destinationPath("network-topology.mmd"); + this.composeWith(ExportNetworkTopologyPath, { + arguments: [fabloConfigPath, outputFile], + }); + this.on("end", () => { console.log("Done & done !!! Try the network out: "); console.log("-> fablo up - to start network"); From e37c5d3b8468504d1205db827eb23d6be0350488 Mon Sep 17 00:00:00 2001 From: Osama Rabea <159753803+OsamaRab3@users.noreply.github.com> Date: Sat, 2 Aug 2025 17:24:34 +0300 Subject: [PATCH 457/471] Upgrade Blockchain Explorer (#590) Signed-off-by: Osama Rabea Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-04-snapshot.sh | 3 ++- ...2-1org-1chaincode-raft-explorer.json.test.ts.snap | 8 ++++---- ...blo-config-hlf2-1org-1chaincode.json.test.ts.snap | 2 +- ...-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 2 +- ...fig-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 2 +- ...-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 8 ++++---- ...lo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 2 +- ...onfig-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 2 +- src/setup-docker/index.ts | 2 +- .../templates/fabric-docker/docker-compose.yaml | 12 ++++++------ 10 files changed, 22 insertions(+), 21 deletions(-) diff --git a/e2e-network/docker/test-04-snapshot.sh b/e2e-network/docker/test-04-snapshot.sh index 7258aa48d..2d370f245 100755 --- a/e2e-network/docker/test-04-snapshot.sh +++ b/e2e-network/docker/test-04-snapshot.sh @@ -56,7 +56,6 @@ waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. Time to relax." waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" -waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" @@ -114,6 +113,8 @@ hook_command="perl -i -pe 's/FABRIC_VERSION=2\.3\.3/FABRIC_VERSION=2\.4\.2/g' ./ "$FABLO_HOME/fablo.sh" start "$FABLO_HOME/fablo.sh" chaincodes install ) + +waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" sleep 5 diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index c97954eac..6ad21b120 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1527,7 +1527,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -2129,14 +2129,14 @@ services: - basic db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" + test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" interval: 5s timeout: 10s retries: 7 @@ -2146,7 +2146,7 @@ services: - basic explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 8e5ecbb2c..405d8f727 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1438,7 +1438,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 021594c77..89f3d0113 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2099,7 +2099,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index ee92aa0b2..0e9378e52 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3022,7 +3022,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 724512188..f9e1434f0 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3317,7 +3317,7 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -4838,14 +4838,14 @@ services: - basic db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" + test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" interval: 5s timeout: 10s retries: 7 @@ -4855,7 +4855,7 @@ services: - basic explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index ff2baf773..dea718ac0 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1514,7 +1514,7 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2 "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 2a9dad77a..6aa476301 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1539,7 +1539,7 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 diff --git a/src/setup-docker/index.ts b/src/setup-docker/index.ts index 47d568fea..88957ce16 100644 --- a/src/setup-docker/index.ts +++ b/src/setup-docker/index.ts @@ -169,7 +169,7 @@ export default class SetupDockerGenerator extends Generator { fabloVersion: config.fabloVersion, fabloBuild: getBuildInfo(), fabloRestVersion: "0.1.2", - hyperledgerExplorerVersion: "1.1.8", + hyperledgerExplorerVersion: "2.0.0", fabricCouchDbVersion: "0.4.18", couchDbVersion: "3.1", fabricCaPostgresVersion: "14", diff --git a/src/setup-docker/templates/fabric-docker/docker-compose.yaml b/src/setup-docker/templates/fabric-docker/docker-compose.yaml index 534e4cc95..a209bd53d 100755 --- a/src/setup-docker/templates/fabric-docker/docker-compose.yaml +++ b/src/setup-docker/templates/fabric-docker/docker-compose.yaml @@ -138,14 +138,14 @@ services: <%_ if (org.tools.explorer && !global.tools.explorer) { _%> db.<%= org.tools.explorer.address %>: - image: hyperledger/explorer-db:${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer-db:${HYPERLEDGER_EXPLORER_VERSION} container_name: db.<%= org.tools.explorer.address %> environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" + test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" interval: 5s timeout: 10s retries: 7 @@ -155,7 +155,7 @@ services: - basic <%= org.tools.explorer.address %>: - image: hyperledger/explorer:${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer:${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: <%= org.tools.explorer.address %> environment: @@ -331,14 +331,14 @@ services: <%_ if (global.tools.explorer) { _%> db.<%= global.tools.explorer.address %>: - image: hyperledger/explorer-db:${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer-db:${HYPERLEDGER_EXPLORER_VERSION} container_name: db.<%= global.tools.explorer.address %> environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" + test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" interval: 5s timeout: 10s retries: 7 @@ -348,7 +348,7 @@ services: - basic <%= global.tools.explorer.address %>: - image: hyperledger/explorer:${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer:${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: <%= global.tools.explorer.address %> environment: From 14bc6687a056d13562a2649532f91b8cf079b261 Mon Sep 17 00:00:00 2001 From: Great Date: Mon, 11 Aug 2025 12:20:32 +0100 Subject: [PATCH 458/471] ci: fix test-05-v3 (#591) Signed-off-by: Great Signed-off-by: Pereowei Daniel --- .github/workflows/test-on-push.yml | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index c4e4da805..7398e28a4 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -172,25 +172,28 @@ jobs: test-05-v3: needs: test-main - runs-on: macos-15 + runs-on: macos-13 steps: - name: Check out repository code uses: actions/checkout@v2 - - name: Install Docker + Colima + - name: Fix Python conflicts between macOS runner and Homebrew run: | - brew update - brew install qemu colima docker - brew uninstall --ignore-dependencies lima - curl https://raw.githubusercontent.com/Homebrew/homebrew-core/45464b6c4788a80be3f131ab5e2a4468cdfa960c/Formula/l/lima.rb > lima.rb - brew install lima.rb - LIMACTL_PATH=$(brew --prefix)/bin/limactl - sudo curl -L -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/master/limactl - sudo chmod +x $LIMACTL_PATH - colima start --network-address --arch arm64 --vm-type=qemu - mkdir -p ~/.docker/cli-plugins - brew install docker-compose - ln -sfn $(brew --prefix)/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose + # see https://github.com/actions/setup-python/issues/577 + brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done + + - name: Install homebrew dependencies + run: | + set -x + sudo chmod ugo+w /usr/local/bin + brew install docker docker-compose lima qemu + + - name: Install and start Colima + run: | + brew install colima + colima version + colima start --cpu 3 --memory 6 --disk 100 --vm-type=qemu --mount-type=sshfs --dns=1.1.1.1 + colima restart - name: Install dependencies run: | From c473161567d83eeb8f3e443b1ec5c762d0f8ee48 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Tue, 12 Aug 2025 07:59:34 -0500 Subject: [PATCH 459/471] fix-update test suites Signed-off-by: Pereowei Daniel --- ...hlf2-1org-1chaincode-k8s.json.test.ts.snap | 26 -------- ...1chaincode-raft-explorer.json.test.ts.snap | 32 ++------- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 28 +------- ...2chaincodes-private-data.yaml.test.ts.snap | 36 +--------- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 65 +------------------ ...1chaincode-raft-explorer.json.test.ts.snap | 63 ++---------------- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 28 +------- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 28 +------- 8 files changed, 13 insertions(+), 293 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap index 98925532a..7cff81ecf 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-k8s.json.test.ts.snap @@ -482,31 +482,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-k8s.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -517,6 +492,5 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-k8s.json should create proper "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/chaincode-functions.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/fabric-k8s/scripts/util.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-k8s.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 6ad21b120..81966a0c9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1527,7 +1527,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -2129,14 +2129,14 @@ services: - basic db.explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" + test: "pg_isready -h localhost -p 5432 -q -U postgres" interval: 5s timeout: 10s retries: 7 @@ -2146,7 +2146,7 @@ services: - basic explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: @@ -3450,29 +3450,6 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - postgres] - Org1_peer0[Peer: peer0] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3501,6 +3478,5 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 405d8f727..e15dd2f9c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1438,7 +1438,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3315,31 +3315,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3366,6 +3341,5 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper fil "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 89f3d0113..5667f9148 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2099,7 +2099,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -4245,39 +4245,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Org_Org2 [Org: Org2] - CA_ca_Org2[CA: ca_Org2 - sqlite] - Org2_peer0[Peer: peer0] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_or_policy_chaincode[Chaincode: or-policy-chaincode] - Chaincode_and_policy_chaincode[Chaincode: and-policy-chaincode] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 - Org_Org2 -.-> Channel_my_channel1 - Org2_peer0 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -4310,6 +4277,5 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 0e9378e52..956466e56 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3022,7 +3022,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -5655,68 +5655,6 @@ perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric- " `; -exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` -"graph TD - - subgraph Org_Orderer1 [Org: Orderer1] - CA_ca_Orderer1[CA: ca_Orderer1 - sqlite] - end - - subgraph Org_Orderer2 [Org: Orderer2] - CA_ca_Orderer2[CA: ca_Orderer2 - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Org_Org2 [Org: Org2] - CA_ca_Org2[CA: ca_Org2 - sqlite] - Org2_peer0[Peer: peer0] - Org2_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - subgraph Channel_my_channel2 [Channel: my-channel2] - Chaincode_chaincode2[Chaincode: chaincode2] - end - - subgraph Channel_my_channel3 [Channel: my-channel3] - end - - %% Connections - Org_Orderer1 --> Channel_my_channel1 - Org_Orderer1 --> Channel_my_channel2 - Org_Orderer1 --> Channel_my_channel3 - Org_Orderer2 --> Channel_my_channel1 - Org_Orderer2 --> Channel_my_channel2 - Org_Orderer2 --> Channel_my_channel3 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 - Org_Org2 -.-> Channel_my_channel1 - Org2_peer0 --> Channel_my_channel1 - Org2_peer1 --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel2 - Org1_peer0 --> Channel_my_channel2 - Org1_peer1 --> Channel_my_channel2 - Org_Org2 -.-> Channel_my_channel2 - Org2_peer0 --> Channel_my_channel2 - Org2_peer1 --> Channel_my_channel2 - Org_Org1 -.-> Channel_my_channel3 - Org1_peer0 --> Channel_my_channel3 - Org1_peer1 --> Channel_my_channel3 - Org_Org2 -.-> Channel_my_channel3 - Org2_peer0 --> Channel_my_channel3 - Org2_peer1 --> Channel_my_channel3 -" -`; - exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create proper files from samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-config/.gitignore", @@ -5751,6 +5689,5 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index f9e1434f0..8996f3c1a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3317,7 +3317,7 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -4838,14 +4838,14 @@ services: - basic db.explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" + test: "pg_isready -h localhost -p 5432 -q -U postgres" interval: 5s timeout: 10s retries: 7 @@ -4855,7 +4855,7 @@ services: - basic explorer.example.com: - image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: @@ -6171,60 +6171,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Org_Org2 [Org: Org2] - CA_ca_Org2[CA: ca_Org2 - sqlite] - Org2_peer0[Peer: peer0] - Org2_peer1[Peer: peer1] - end - - subgraph Org_Org3 [Org: Org3] - CA_ca_Org3[CA: ca_Org3 - sqlite] - Org3_peer0[Peer: peer0] - Org3_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - subgraph Channel_my_channel2 [Channel: my-channel2] - end - - subgraph Channel_my_channel3 [Channel: my-channel3] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Orderer --> Channel_my_channel2 - Org_Orderer --> Channel_my_channel3 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 - Org_Org2 -.-> Channel_my_channel2 - Org2_peer0 --> Channel_my_channel2 - Org2_peer1 --> Channel_my_channel2 - Org_Org1 -.-> Channel_my_channel3 - Org1_peer0 --> Channel_my_channel3 - Org1_peer1 --> Channel_my_channel3 - Org_Org2 -.-> Channel_my_channel3 - Org2_peer0 --> Channel_my_channel3 - Org2_peer1 --> Channel_my_channel3 -" -`; - exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -6263,6 +6209,5 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index dea718ac0..bf8ce1b43 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1514,7 +1514,7 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2 "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3564,31 +3564,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3615,6 +3590,5 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper fi "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf3-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 6aa476301..0a0e4c2cb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1539,7 +1539,7 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=2.0.0 +HYPERLEDGER_EXPLORER_VERSION=1.1.8 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3588,31 +3588,6 @@ echo "Executing post-generate hook" " `; -exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` -"graph TD - - subgraph Org_Orderer [Org: Orderer] - CA_ca_Orderer[CA: ca_Orderer - sqlite] - end - - subgraph Org_Org1 [Org: Org1] - CA_ca_Org1[CA: ca_Org1 - sqlite] - Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] - end - - subgraph Channel_my_channel1 [Channel: my-channel1] - Chaincode_chaincode1[Chaincode: chaincode1] - end - - %% Connections - Org_Orderer --> Channel_my_channel1 - Org_Org1 -.-> Channel_my_channel1 - Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 -" -`; - exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create proper files from samples/fablo-config-hlf3-bft-1orgs-1chaincode.json 1`] = ` [ "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-config/.gitignore", @@ -3639,6 +3614,5 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/hooks/post-generate.sh", - "e2e/__tmp__/samples/fablo-config-hlf3-bft-1orgs-1chaincode.json.tmpdir/fablo-target/network-topology.mmd", ] `; From 78856063437ae7ffb325d75b99142eb89d90fb15 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 15 Aug 2025 08:51:05 -0500 Subject: [PATCH 460/471] fix-DCO error Signed-off-by: Pereowei Daniel --- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 175 +--------------- ...2chaincodes-private-data.yaml.test.ts.snap | 195 ++--------------- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 197 ++---------------- ...1chaincode-raft-explorer.json.test.ts.snap | 183 +--------------- e2e/__snapshots__/fabloCommands.test.ts.snap | 2 - e2e/__snapshots__/schema.test.ts.snap | 7 - 6 files changed, 30 insertions(+), 729 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 8e5ecbb2c..989a10de6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,8 +1651,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1677,7 +1675,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" else @@ -1707,7 +1705,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1755,7 +1753,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1785,7 +1783,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -1975,8 +1972,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2021,8 +2016,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2080,48 +2073,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2486,73 +2437,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF - else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF - fi - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2576,53 +2460,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" - - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" - - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2635,7 +2472,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -2648,7 +2484,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -2683,10 +2518,6 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 4f01b5e03..464c752e9 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2365,8 +2365,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -2393,10 +2391,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" else @@ -2410,10 +2408,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" else @@ -2443,10 +2441,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2462,10 +2460,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2525,10 +2523,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2544,10 +2542,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2580,7 +2578,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -2808,8 +2805,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2854,8 +2849,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2949,8 +2942,6 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -3008,48 +2999,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -3414,73 +3363,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF - else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF - fi - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3504,53 +3386,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" - - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" - - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3563,7 +3398,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -3576,7 +3410,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -3611,10 +3444,6 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index ee92aa0b2..a5855968c 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3467,8 +3467,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3510,10 +3508,10 @@ installChaincodes() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" else @@ -3526,10 +3524,10 @@ installChaincodes() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" else @@ -3558,10 +3556,10 @@ installChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3576,10 +3574,10 @@ installChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3638,10 +3636,10 @@ upgradeChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3656,10 +3654,10 @@ upgradeChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3704,7 +3702,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -4139,8 +4136,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4190,8 +4185,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4301,8 +4294,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4352,8 +4343,6 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4411,48 +4400,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -4817,73 +4764,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF - else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF - fi - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4907,53 +4787,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" - - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" - - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4966,7 +4799,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -4979,7 +4811,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -5014,10 +4845,6 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 724512188..85ff1963e 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3801,8 +3801,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3845,7 +3843,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -3875,7 +3873,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3923,7 +3921,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3962,7 +3960,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -4306,8 +4303,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4355,8 +4350,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4539,8 +4532,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4588,8 +4579,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4772,8 +4761,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4821,8 +4808,6 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4923,48 +4908,6 @@ certsGenerate() { done } -certsGenerateCCaaS() { - local CONFIG_PATH=$1 - local CONTAINER_NAME=$2 - local ORG_DOMAIN=$3 - local CHAINCODE_NAME=$4 - local PEER_ADDRESS=$5 - - local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" - mkdir -p "$OUTPUT_PATH" - - local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" - local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" - - echo "Generating TLS certs for \${CONTAINER_NAME}..." - inputLog "CONFIG_PATH: $CONFIG_PATH" - inputLog "CONTAINER_NAME: $CONTAINER_NAME" - inputLog "ORG_DOMAIN: $ORG_DOMAIN" - inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CA cert: $CA_CERT" - inputLog "CA key : $CA_KEY" - inputLog "OUTPUT_PATH: $OUTPUT_PATH" - - docker run --rm \\ - -v "$OUTPUT_PATH:/certs" \\ - -v "$CA_CERT:/ca/ca.crt:ro" \\ - -v "$CA_KEY:/ca/ca.key:ro" \\ - alpine:latest sh -c ' - apk add --no-cache openssl >/dev/null && - openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && - openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && - base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key && - chown -R '"$(id -u):$(id -g)"' /certs - ' - - cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" - echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" -} - genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -5329,73 +5272,6 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } -chaincodePackageCCaaS() { - local CLI_NAME=$1 - local PEER_ADDRESS=$2 - local CHAINCODE_NAME=$3 - local CHAINCODE_VERSION=$4 - local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" - local CHAINCODE_LANG=$5 - local CHAINCODE_IMAGE=$6 - local CONTAINER_PORT=$7 - local CONTAINER_NAME=$8 - local TLS_ENABLED=$9 - - echo "Packaging chaincode $CHAINCODE_NAME..." - inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" - inputLog "PEER_ADDRESS: $PEER_ADDRESS" - inputLog "CLI_NAME: $CLI_NAME" - inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" - inputLog "CONTAINER_PORT: $CONTAINER_PORT" - inputLog "TLS_ENABLED: $TLS_ENABLED" - - echo "Packaging chaincode as CCAAS (external builder)..." - - local PACKAGE_DIR="./chaincode-packages/ccaas_$CONTAINER_NAME" - - mkdir -p "$PACKAGE_DIR" - echo "{\\"type\\":\\"$CHAINCODE_LANG\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" - - mkdir -p "$PACKAGE_DIR/code" - - if [ "$TLS_ENABLED" = true ]; then - local ROOT_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/peer.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.crt | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(docker exec "$CONTAINER_NAME" cat /etc/hyperledger/fabric/client.key | awk '{printf "%s\\\\n", $0}') - - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "domain": "\${CONTAINER_NAME}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, - "client_auth_required": true, - "client_cert": "$SERVER_CERT", - "client_key": "$SERVER_KEY", - "root_cert": "$ROOT_CERT" -} -EOF - else - cat <"$PACKAGE_DIR/code/connection.json" -{ - "address": "\${CONTAINER_NAME}:\${CONTAINER_PORT}", - "dial_timeout": "10s", - "tls_required": $TLS_ENABLED, -} -EOF - fi - tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json - tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz - - docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" - - rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" - rm -rf "$PACKAGE_DIR" - - echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" -} - chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5419,53 +5295,6 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } -restartChaincodeContainerWithCorrectId() { - local PEER_ADDRESS="$1" - local CHAINCODE_NAME="$2" - local CHAINCODE_LABEL="$3" - local CC_PACKAGE_ID="$4" - local CHAINCODE_IMAGE="$5" - - local PACKAGE_HASH="\${CC_PACKAGE_ID#*:}" - local CONTAINER_NAME="\${CHAINCODE_NAME}_\${PEER_ADDRESS%%:*}" - - echo "🌀 Restarting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" - - local TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/ccaas/$CONTAINER_NAME/tls" - local PORT_MAP="7052:7052" - - local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') - - docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true - - docker run -d \\ - --name "$CONTAINER_NAME" \\ - -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ - -e CHAINCODE_SERVER_ADDRESS=0.0.0:7052 \\ - -e DEBUG=true \\ - -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ - -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ - -e CORE_CHAINCODE_LOGGING_SHIM=info \\ - -e CORE_PEER_TLS_ENABLED=true \\ - -e CORE_TLS_CLIENT_KEY_PATH=/etc/hyperledger/fabric/client.key \\ - -e CORE_TLS_CLIENT_CERT_PATH=/etc/hyperledger/fabric/client.crt \\ - -e CORE_TLS_CLIENT_KEY_FILE=/etc/hyperledger/fabric/client_pem.key \\ - -e CORE_TLS_CLIENT_CERT_FILE=/etc/hyperledger/fabric/client_pem.crt \\ - -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ - -e CORE_PEER_LOCALMSPID=Org1MSP \\ - -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ - -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ - -v "$TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ - -v "$TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ - -v "$TLS_PATH/client_pem.key:/etc/hyperledger/fabric/client_pem.key" \\ - -v "$TLS_PATH/client_pem.crt:/etc/hyperledger/fabric/client_pem.crt" \\ - -v "$TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ - -p "$PORT_MAP" \\ - --network "$NETWORK" \\ - "$CHAINCODE_IMAGE" -} - chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5478,7 +5307,6 @@ chaincodeApprove() { local INIT_REQUIRED=$8 local CA_CERT=$9 local COLLECTIONS_CONFIG=\${10} - local CHAINCODE_LANG=\${11} echo "Approving chaincode $CHAINCODE_NAME..." inputLog "CLI_NAME: $CLI_NAME" @@ -5491,7 +5319,6 @@ chaincodeApprove() { inputLog "INIT_REQUIRED: $INIT_REQUIRED" inputLog "CA_CERT: $CA_CERT" inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" - inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" local CA_CERT_PARAMS=() if [ -n "$CA_CERT" ]; then @@ -5526,10 +5353,6 @@ chaincodeApprove() { CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" - if [ "$CHAINCODE_LANG" = "ccaas" ]; then - local CHAINCODE_IMAGE=\${12} - restartChaincodeContainerWithCorrectId "$PEER_ADDRESS" "$CHAINCODE_NAME" "$CHAINCODE_LABEL" "$CC_PACKAGE_ID" "$CHAINCODE_IMAGE" - fi local QUERYCOMMITTED_RESPONSE local SEQUENCE diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 7192088ba..d6f843437 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2009,7 +2009,6 @@ Validation warnings count: 0 } } }, - "peerChaincodeInstances": [], "privateData": [] }, { @@ -2456,7 +2455,6 @@ Validation warnings count: 0 } } }, - "peerChaincodeInstances": [], "privateData": [] } ], diff --git a/e2e/__snapshots__/schema.test.ts.snap b/e2e/__snapshots__/schema.test.ts.snap index 6cbed0b92..8bbbc9bed 100644 --- a/e2e/__snapshots__/schema.test.ts.snap +++ b/e2e/__snapshots__/schema.test.ts.snap @@ -104,13 +104,6 @@ exports[`schema should match snapshot 1`] = ` "title": "Name", "type": "string", }, - "port": { - "$id": "#/properties/chaincodes/items/properties/port", - "maximum": 65535, - "minimum": 10, - "title": "Chaincode port", - "type": "integer", - }, "privateData": { "$id": "#/properties/chaincodes/items/properties/privateData", "items": { From b06d3accc60e0fdf7d0dccd8d7cd4bdfcf58e4b7 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Mon, 18 Aug 2025 04:15:28 -0500 Subject: [PATCH 461/471] fix-update branch and snapshots Signed-off-by: Pereowei Daniel --- ...1chaincode-raft-explorer.json.test.ts.snap | 3545 ++++++++++++++++- ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 239 +- ...2chaincodes-private-data.yaml.test.ts.snap | 281 +- ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 275 +- ...1chaincode-raft-explorer.json.test.ts.snap | 253 +- ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 220 +- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 220 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 63 +- 8 files changed, 4937 insertions(+), 159 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b79c8f74e..b40924c24 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1,3 +1,3546 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = `[]`; +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"/config +/crypto-config +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"################################################################################ +# SECTION: Capabilities +################################################################################ +Capabilities: + Channel: &ChannelCapabilities + V2_0: true + Orderer: &OrdererCapabilities + V2_0: true + Application: &ApplicationCapabilities + V2_5: true + +################################################################################ +# CHANNEL Defaults +################################################################################ +Channel: &ChannelDefaults + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Capabilities: + <<: *ChannelCapabilities + +################################################################################ +# Section: Organizations +################################################################################ +Organizations: + - &Orderer + Name: OrdererMSP + ID: OrdererMSP + MSPDir: crypto-config/peerOrganizations/orderer.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Writers: + Type: Signature + Rule: "OR('OrdererMSP.member')" + Admins: + Type: Signature + Rule: "OR('OrdererMSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('OrdererMSP.member')" + + AnchorPeers: + + - &Org1 + Name: Org1MSP + ID: Org1MSP + MSPDir: crypto-config/peerOrganizations/org1.example.com/msp + + Policies: + Readers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Writers: + Type: Signature + Rule: "OR('Org1MSP.member')" + Admins: + Type: Signature + Rule: "OR('Org1MSP.admin')" + Endorsement: + Type: Signature + Rule: "OR('Org1MSP.member')" + + AnchorPeers: + - Host: peer0.org1.example.com + Port: 7041 + +################################################################################ +# SECTION: Application +################################################################################ +Application: &ApplicationDefaults + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Application policies, their canonical path is + # /Channel/Application/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + Endorsement: + Type: ImplicitMeta + Rule: "MAJORITY Endorsement" + Capabilities: + <<: *ApplicationCapabilities + +################################################################################ +# SECTION: Orderer +################################################################################ +Orderer: &Group1Defaults + OrdererType: etcdraft + Addresses: + - orderer0.group1.orderer.example.com:7030 + EtcdRaft: + Consenters: + - Host: orderer0.group1.orderer.example.com + Port: 7030 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + + BatchTimeout: 2s + BatchSize: + MaxMessageCount: 1 + AbsoluteMaxBytes: 99 MB + PreferredMaxBytes: 512 KB + Organizations: + # Policies defines the set of policies at this level of the config tree + # For Orderer policies, their canonical path is + # /Channel/Orderer/ + Policies: + Readers: + Type: ImplicitMeta + Rule: "ANY Readers" + Writers: + Type: ImplicitMeta + Rule: "ANY Writers" + Admins: + Type: ImplicitMeta + Rule: "MAJORITY Admins" + # BlockValidation specifies what signatures must be included in the block + # from the orderer for the peer to validate it. + BlockValidation: + Type: ImplicitMeta + Rule: "ANY Writers" + Capabilities: + <<: *OrdererCapabilities + +################################################################################ +# Profile +################################################################################ +# https://github:com/hyperledger/fabric/blob/master/sampleconfig/configtx.yaml + +Profiles: + # Profile used to create Genesis block for group group1 # + Group1Genesis: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *OrdererCapabilities + Consortiums: + SampleConsortium: + Organizations: + - *Orderer + - *Org1 + + # Profile used to create channeltx for my-channel1 # + MyChannel1: + <<: *ChannelDefaults + Orderer: + <<: *Group1Defaults + Organizations: + - *Orderer + Capabilities: + <<: *ApplicationCapabilities + Consortium: SampleConsortium + Consortiums: + SampleConsortium: + Organizations: + - *Org1 + Application: + <<: *ApplicationDefaults + Organizations: + - *Org1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-orderer", + "description": "Connection profile for Orderer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Orderer" + }, + "organizations": { + "Orderer": { + "mspid": "OrdererMSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.orderer.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.orderer.example.com": { + "url": "https://localhost:7020", + "caName": "ca.orderer.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-orderer +description: Connection profile for Orderer in Fablo network +version: 1.0.0 +client: + organization: Orderer +organizations: + Orderer: + mspid: OrdererMSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.orderer.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.orderer.example.com: + url: https://localhost:7020 + caName: ca.orderer.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/ca.orderer.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Org1 in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1" + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "peers": [ + "peer0.org1.example.com" + ], + "certificateAuthorities": [ + "ca.org1.example.com" + ] + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://localhost:7041", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer0.org1.example.com" + } + } + }, + "certificateAuthorities": { + "ca.org1.example.com": { + "url": "https://localhost:7040", + "caName": "ca.org1.example.com", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem" + }, + "httpOptions": { + "verify": false + } + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"name: fablo-test-network-org1 +description: Connection profile for Org1 in Fablo network +version: 1.0.0 +client: + organization: Org1 +organizations: + Org1: + mspid: Org1MSP + peers: + - peer0.org1.example.com + certificateAuthorities: + - ca.org1.example.com +peers: + peer0.org1.example.com: + url: grpcs://localhost:7041 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer0.org1.example.com +certificateAuthorities: + ca.org1.example.com: + url: https://localhost:7040 + caName: ca.org1.example.com + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem + httpOptions: + verify: false +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Orderer + Domain: orderer.example.com + Specs: + - Hostname: orderer0.group1 + Template: + Count: 0 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"PeerOrgs: + - Name: Org1 + Domain: org1.example.com + Specs: + Template: + Count: 1 + Users: + Count: 1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "network-configs": { + "network-org1": { + "name": "Network of Org1", + "profile": "/opt/explorer/app/platform/fabric/connection-profile/connection-profile-org1.json" + } + }, + "license": "Apache-2.0" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"{ + "name": "fablo-test-network-org1", + "description": "Connection profile for Hyperledger Explorer in Fablo network", + "version": "1.0.0", + "client": { + "organization": "Org1", + "tlsEnable": true, + "enableAuthentication": true, + "adminCredential": { + "id": "admin", + "password": "adminpw" + }, + "connection": { + "timeout": { + "peer": { + "endorser": "300" + }, + "orderer": "300" + } + } + }, + "organizations": { + "Org1": { + "mspid": "Org1MSP", + "adminPrivateKey": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" + }, + "peers": [ + "peer0.org1.example.com" + ], + "signedCert": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" + } + } + }, + "peers": { + "peer0.org1.example.com": { + "url": "grpcs://peer0.org1.example.com:7041", + "tlsCACerts": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" + } + } + }, + "channels": { + "my-channel1": { + "peers": {} + } + } +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + orderer: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"############################################################################# +# This is a configuration file for the fabric-ca-server command. +# +# COMMAND LINE ARGUMENTS AND ENVIRONMENT VARIABLES +# ------------------------------------------------ +# Each configuration element can be overridden via command line +# arguments or environment variables. The precedence for determining +# the value of each element is as follows: +# 1) command line argument +# Examples: +# a) --port 443 +# To set the listening port +# b) --ca.keyfile ../mykey.pem +# To set the "keyfile" element in the "ca" section below; +# note the '.' separator character. +# 2) environment variable +# Examples: +# a) FABRIC_CA_SERVER_PORT=443 +# To set the listening port +# b) FABRIC_CA_SERVER_CA_KEYFILE="../mykey.pem" +# To set the "keyfile" element in the "ca" section below; +# note the '_' separator character. +# 3) configuration file +# 4) default value (if there is one) +# All default values are shown beside each element below. +# +# FILE NAME ELEMENTS +# ------------------ +# The value of all fields whose name ends with "file" or "files" are +# name or names of other files. +# For example, see "tls.certfile" and "tls.clientauth.certfiles". +# The value of each of these fields can be a simple filename, a +# relative path, or an absolute path. If the value is not an +# absolute path, it is interpreted as being relative to the location +# of this configuration file. +# +############################################################################# + +# Version of config file +version: 1.5.5 + +# Server's listening port (default: 7054) +port: 7054 + +# Cross-Origin Resource Sharing (CORS) +cors: + enabled: false + origins: + - "*" + +# Enables debug logging (default: false) +debug: false + +# Size limit of an acceptable CRL in bytes (default: 512000) +crlsizelimit: 512000 + +############################################################################# +# TLS section for the server's listening port +# +# The following types are supported for client authentication: NoClientCert, +# RequestClientCert, RequireAnyClientCert, VerifyClientCertIfGiven, +# and RequireAndVerifyClientCert. +# +# Certfiles is a list of root certificate authorities that the server uses +# when verifying client certificates. +############################################################################# +tls: + # Enable TLS (default: false) + enabled: false + # TLS for the server's listening port + certfile: + keyfile: + clientauth: + type: noclientcert + certfiles: + +############################################################################# +# The CA section contains information related to the Certificate Authority +# including the name of the CA, which should be unique for all members +# of a blockchain network. It also includes the key and certificate files +# used when issuing enrollment certificates (ECerts). +# The chainfile (if it exists) contains the certificate chain which +# should be trusted for this CA, where the 1st in the chain is always the +# root CA certificate. +############################################################################# +ca: + # Name of this CA + name: + # Key file (is only used to import a private key into BCCSP) + keyfile: + # Certificate file (default: ca-cert.pem) + certfile: + # Chain file + chainfile: + +############################################################################# +# The gencrl REST endpoint is used to generate a CRL that contains revoked +# certificates. This section contains configuration options that are used +# during gencrl request processing. +############################################################################# +crl: + # Specifies expiration for the generated CRL. The number of hours + # specified by this property is added to the UTC time, the resulting time + # is used to set the 'Next Update' date of the CRL. + expiry: 24h + +############################################################################# +# The registry section controls how the fabric-ca-server does two things: +# 1) authenticates enrollment requests which contain a username and password +# (also known as an enrollment ID and secret). +# 2) once authenticated, retrieves the identity's attribute names and values. +# These attributes are useful for making access control decisions in +# chaincode. +# There are two main configuration options: +# 1) The fabric-ca-server is the registry. +# This is true if "ldap.enabled" in the ldap section below is false. +# 2) An LDAP server is the registry, in which case the fabric-ca-server +# calls the LDAP server to perform these tasks. +# This is true if "ldap.enabled" in the ldap section below is true, +# which means this "registry" section is ignored. +############################################################################# +registry: + # Maximum number of times a password/secret can be reused for enrollment + # (default: -1, which means there is no limit) + maxenrollments: -1 + + # Contains identity information which is used when LDAP is disabled + identities: + - name: admin + pass: adminpw + type: client + affiliation: "" + attrs: + hf.Registrar.Roles: "*" + hf.Registrar.DelegateRoles: "*" + hf.Revoker: true + hf.IntermediateCA: true + hf.GenCRL: true + hf.Registrar.Attributes: "*" + hf.AffiliationMgr: true + +############################################################################# +# Database section +# Supported types are: "sqlite3", "postgres", and "mysql". +# The datasource value depends on the type. +# If the type is "sqlite3", the datasource value is a file name to use +# as the database store. Since "sqlite3" is an embedded database, it +# may not be used if you want to run the fabric-ca-server in a cluster. +# To run the fabric-ca-server in a cluster, you must choose "postgres" +# or "mysql". +############################################################################# +db: + type: sqlite3 + datasource: fabric-ca-server.db + tls: + enabled: false + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# LDAP section +# If LDAP is enabled, the fabric-ca-server calls LDAP to: +# 1) authenticate enrollment ID and secret (i.e. username and password) +# for enrollment requests; +# 2) To retrieve identity attributes +############################################################################# +ldap: + # Enables or disables the LDAP client (default: false) + # If this is set to true, the "registry" section is ignored. + enabled: false + # The URL of the LDAP server + url: ldap://:@:/ + # TLS configuration for the client connection to the LDAP server + tls: + certfiles: + client: + certfile: + keyfile: + # Attribute related configuration for mapping from LDAP entries to Fabric CA attributes + attribute: + # 'names' is an array of strings containing the LDAP attribute names which are + # requested from the LDAP server for an LDAP identity's entry + names: ['uid', 'member'] + # The 'converters' section is used to convert an LDAP entry to the value of + # a fabric CA attribute. + # For example, the following converts an LDAP 'uid' attribute + # whose value begins with 'revoker' to a fabric CA attribute + # named "hf.Revoker" with a value of "true" (because the boolean expression + # evaluates to true). + # converters: + # - name: hf.Revoker + # value: attr("uid") =~ "revoker*" + converters: + - name: + value: + # The 'maps' section contains named maps which may be referenced by the 'map' + # function in the 'converters' section to map LDAP responses to arbitrary values. + # For example, assume a user has an LDAP attribute named 'member' which has multiple + # values which are each a distinguished name (i.e. a DN). For simplicity, assume the + # values of the 'member' attribute are 'dn1', 'dn2', and 'dn3'. + # Further assume the following configuration. + # converters: + # - name: hf.Registrar.Roles + # value: map(attr("member"),"groups") + # maps: + # groups: + # - name: dn1 + # value: peer + # - name: dn2 + # value: client + # The value of the user's 'hf.Registrar.Roles' attribute is then computed to be + # "peer,client,dn3". This is because the value of 'attr("member")' is + # "dn1,dn2,dn3", and the call to 'map' with a 2nd argument of + # "group" replaces "dn1" with "peer" and "dn2" with "client". + maps: + groups: + - name: + value: + +############################################################################# +# Affiliations section. Fabric CA server can be bootstrapped with the +# affiliations specified in this section. Affiliations are specified as maps. +# For example: +# businessunit1: +# department1: +# - team1 +# businessunit2: +# - department2 +# - department3 +# +# Affiliations are hierarchical in nature. In the above example, +# department1 (used as businessunit1.department1) is the child of businessunit1. +# team1 (used as businessunit1.department1.team1) is the child of department1. +# department2 (used as businessunit2.department2) and department3 (businessunit2.department3) +# are children of businessunit2. +# Note: Affiliations are case sensitive except for the non-leaf affiliations +# (like businessunit1, department1, businessunit2) that are specified in the configuration file, +# which are always stored in lower case. +############################################################################# +affiliations: + org1: + +############################################################################# +# Signing section +# +# The "default" subsection is used to sign enrollment certificates; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +# +# The "ca" profile subsection is used to sign intermediate CA certificates; +# the default expiration ("expiry" field) is "43800h" which is 5 years in hours. +# Note that "isca" is true, meaning that it issues a CA certificate. +# A maxpathlen of 0 means that the intermediate CA cannot issue other +# intermediate CA certificates, though it can still issue end entity certificates. +# (See RFC 5280, section 4.2.1.9) +# +# The "tls" profile subsection is used to sign TLS certificate requests; +# the default expiration ("expiry" field) is "8760h", which is 1 year in hours. +############################################################################# +signing: + default: + usage: + - digital signature + expiry: 8760h + profiles: + ca: + usage: + - cert sign + - crl sign + expiry: 43800h + caconstraint: + isca: true + maxpathlen: 0 + tls: + usage: + - signing + - key encipherment + - server auth + - client auth + - key agreement + expiry: 8760h + +########################################################################### +# Certificate Signing Request (CSR) section. +# This controls the creation of the root CA certificate. +# The expiration for the root CA certificate is configured with the +# "ca.expiry" field below, whose default value is "131400h" which is +# 15 years in hours. +# The pathlength field is used to limit CA certificate hierarchy as described +# in section 4.2.1.9 of RFC 5280. +# Examples: +# 1) No pathlength value means no limit is requested. +# 2) pathlength == 1 means a limit of 1 is requested which is the default for +# a root CA. This means the root CA can issue intermediate CA certificates, +# but these intermediate CAs may not in turn issue other CA certificates +# though they can still issue end entity certificates. +# 3) pathlength == 0 means a limit of 0 is requested; +# this is the default for an intermediate CA, which means it can not issue +# CA certificates though it can still issue end entity certificates. +########################################################################### +csr: + cn: fabric-ca-server + keyrequest: + algo: ecdsa + size: 256 + names: + - C: US + ST: "North Carolina" + L: + O: Hyperledger + OU: Fabric + hosts: + - 483cccf16a98 + - localhost + ca: + expiry: 131400h + pathlength: 1 + +########################################################################### +# Each CA can issue both X509 enrollment certificate as well as Idemix +# Credential. This section specifies configuration for the issuer component +# that is responsible for issuing Idemix credentials. +########################################################################### +idemix: + # Specifies pool size for revocation handles. A revocation handle is an unique identifier of an + # Idemix credential. The issuer will create a pool revocation handles of this specified size. When + # a credential is requested, issuer will get handle from the pool and assign it to the credential. + # Issuer will repopulate the pool with new handles when the last handle in the pool is used. + # A revocation handle and credential revocation information (CRI) are used to create non revocation proof + # by the prover to prove to the verifier that her credential is not revoked. + rhpoolsize: 1000 + + # The Idemix credential issuance is a two step process. First step is to get a nonce from the issuer + # and second step is send credential request that is constructed using the nonce to the isuser to + # request a credential. This configuration property specifies expiration for the nonces. By default is + # nonces expire after 15 seconds. The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration). + nonceexpiration: 15s + + # Specifies interval at which expired nonces are removed from datastore. Default value is 15 minutes. + # The value is expressed in the time.Duration format (see https://golang.org/pkg/time/#ParseDuration) + noncesweepinterval: 15m + +############################################################################# +# BCCSP (BlockChain Crypto Service Provider) section is used to select which +# crypto library implementation to use +############################################################################# +bccsp: + default: SW + sw: + hash: SHA2 + security: 256 + filekeystore: + # The directory used for the software file-based keystore + keystore: msp/keystore + +############################################################################# +# Multi CA section +# +# Each Fabric CA server contains one CA by default. This section is used +# to configure multiple CAs in a single server. +# +# 1) --cacount +# Automatically generate non-default CAs. The names of these +# additional CAs are "ca1", "ca2", ... "caN", where "N" is +# This is particularly useful in a development environment to quickly set up +# multiple CAs. Note that, this config option is not applicable to intermediate CA server +# i.e., Fabric CA server that is started with intermediate.parentserver.url config +# option (-u command line option) +# +# 2) --cafiles +# For each CA config file in the list, generate a separate signing CA. Each CA +# config file in this list MAY contain all of the same elements as are found in +# the server config file except port, debug, and tls sections. +# +# Examples: +# fabric-ca-server start -b admin:adminpw --cacount 2 +# +# fabric-ca-server start -b admin:adminpw --cafiles ca/ca1/fabric-ca-server-config.yaml +# --cafiles ca/ca2/fabric-ca-server-config.yaml +# +############################################################################# + +cacount: + +cafiles: + +############################################################################# +# Intermediate CA section +# +# The relationship between servers and CAs is as follows: +# 1) A single server process may contain or function as one or more CAs. +# This is configured by the "Multi CA section" above. +# 2) Each CA is either a root CA or an intermediate CA. +# 3) Each intermediate CA has a parent CA which is either a root CA or another intermediate CA. +# +# This section pertains to configuration of #2 and #3. +# If the "intermediate.parentserver.url" property is set, +# then this is an intermediate CA with the specified parent +# CA. +# +# parentserver section +# url - The URL of the parent server +# caname - Name of the CA to enroll within the server +# +# enrollment section used to enroll intermediate CA with parent CA +# profile - Name of the signing profile to use in issuing the certificate +# label - Label to use in HSM operations +# +# tls section for secure socket connection +# certfiles - PEM-encoded list of trusted root certificate files +# client: +# certfile - PEM-encoded certificate file for when client authentication +# is enabled on server +# keyfile - PEM-encoded key file for when client authentication +# is enabled on server +############################################################################# +intermediate: + parentserver: + url: + caname: + + enrollment: + hosts: + profile: + label: + + tls: + certfiles: + client: + certfile: + keyfile: + +############################################################################# +# CA configuration section +# +# Configure the number of incorrect password attempts are allowed for +# identities. By default, the value of 'passwordattempts' is 10, which +# means that 10 incorrect password attempts can be made before an identity get +# locked out. +############################################################################# +cfg: + identities: + passwordattempts: 10 + +############################################################################### +# +# Operations section +# +############################################################################### +operations: + # host and port for the operations server + listenAddress: 127.0.0.1:9443 + + # TLS configuration for the operations endpoint + tls: + # TLS enabled + enabled: false + + # path to PEM encoded server certificate for the operations server + cert: + file: + + # path to PEM encoded server key for the operations server + key: + file: + + # require client certificate authentication to access all resources + clientAuthRequired: false + + # paths to PEM encoded ca certificates to trust for client authentication + clientRootCAs: + files: [] + +############################################################################### +# +# Metrics section +# +############################################################################### +metrics: + # statsd, prometheus, or disabled + provider: disabled + + # statsd configuration + statsd: + # network type: tcp or udp + network: udp + + # statsd server address + address: 127.0.0.1:8125 + + # the interval at which locally cached counters and gauges are pushed + # to statsd; timings are pushed immediately + writeInterval: 10s + + # prefix is prepended to all emitted statsd metrics + prefix: server +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +FABLO_NETWORK_ROOT="$(cd "$(dirname "$0")" && pwd)" + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-help.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/base-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/chaincode-functions.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/channel-query-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/snapshot-scripts.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/commands-generated.sh" +source "$FABLO_NETWORK_ROOT/fabric-docker/.env" +source "$FABLO_NETWORK_ROOT/fabric-docker/chaincode-scripts.sh" + +networkUp() { + generateArtifacts + startNetwork + generateChannelsArtifacts + installChannels + installChaincodes + notifyOrgsAboutChannels + printStartSuccessInfo +} + +if [ "$1" = "up" ]; then + networkUp +elif [ "$1" = "down" ]; then + networkDown +elif [ "$1" = "reset" ]; then + networkDown + networkUp +elif [ "$1" = "start" ]; then + startNetwork +elif [ "$1" = "stop" ]; then + stopNetwork +elif [ "$1" = "chaincodes" ] && [ "$2" = "install" ]; then + installChaincodes +elif [ "$1" = "chaincode" ] && [ "$2" = "install" ]; then + installChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "upgrade" ]; then + upgradeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "dev" ]; then + runDevModeChaincode "$3" "$4" +elif [ "$1" = "chaincode" ] && [ "$2" = "invoke" ]; then + chaincodeInvoke "$3" "$4" "$5" "$6" "$7" +elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then + chaincodeList "$3" "$4" +elif [ "$1" = "channel" ]; then + channelQuery "\${@:2}" +elif [ "$1" = "snapshot" ]; then + createSnapshot "$2" +elif [ "$1" = "clone-to" ]; then + cloneSnapshot "$2" "\${3:-""}" +elif [ "$1" = "help" ]; then + printHelp +elif [ "$1" = "--help" ]; then + printHelp +else + echo "No command specified" + echo "Basic commands are: up, down, start, stop, reset" + echo "To list channel query helper commands type: 'fablo channel --help'" + echo "Also check: 'chaincode install'" + echo "Use 'help' or '--help' for more information" +fi +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"FABLO_VERSION=2.2.0 +FABLO_BUILD= +FABLO_REST_VERSION=0.1.2 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 + +COUCHDB_VERSION=3.1 +FABRIC_COUCHDB_VERSION=0.4.18 + +FABLO_CONFIG= +CHAINCODES_BASE_DIR= + +COMPOSE_PROJECT_NAME= +LOGGING_LEVEL=info + +FABRIC_VERSION=2.5.12 +FABRIC_TOOLS_VERSION=2.5.12 +FABRIC_CA_VERSION=1.5.5 +FABRIC_CA_POSTGRES_VERSION=14 +FABRIC_CCENV_VERSION=2.5.12 +FABRIC_BASEOS_VERSION=2.5.12 +FABRIC_JAVAENV_VERSION=2.5 +FABRIC_NODEENV_VERSION=2.5 +RECOMMENDED_NODE_VERSION=16 + +ROOT_CA_ADMIN_NAME=admin +ROOT_CA_ADMIN_PASSWORD=adminpw + +ORDERER_CA_ADMIN_NAME=admin +ORDERER_CA_ADMIN_PASSWORD=adminpw + +ORG1_CA_ADMIN_NAME=admin +ORG1_CA_ADMIN_PASSWORD=adminpw + +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +chaincodeList() { + if [ "$#" -ne 2 ]; then + echo "Expected 2 parameters for chaincode list, but got: $*" + exit 1 + + elif [ "$1" = "peer0.org1.example.com" ]; then + + peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + + else + + echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" + exit 1 + + fi +} + +# Function to perform chaincode invoke. Accepts 5 parameters: +# 1. comma-separated peers +# 2. channel name +# 3. chaincode name +# 4. chaincode command +# 5. transient data (optional) +chaincodeInvoke() { + if [ "$#" -ne 4 ] && [ "$#" -ne 5 ]; then + echo "Expected 4 or 5 parameters for chaincode list, but got: $*" + echo "Usage: fablo chaincode invoke [transient]" + exit 1 + fi + + # Cli needs to be from the same org as the first peer + if [[ "$1" == "peer0.org1.example.com"* ]]; then + cli="cli.org1.example.com" + fi + + peer_addresses="$1" + peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + + peer_certs="$1" + peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + + if [ "$2" = "my-channel1" ]; then + ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" + fi + peerChaincodeInvokeTls "$cli" "$peer_addresses" "$2" "$3" "$4" "$5" "$peer_certs" "$ca_cert" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +source "$FABLO_NETWORK_ROOT/fabric-docker/scripts/channel-query-functions.sh" + +set -eu + +channelQuery() { + if [ "$#" -eq 1 ]; then + printChannelsHelp + + elif [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer0" ]; then + + peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif + + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer0" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + + else + + echo "$@" + echo "$1, $2, $3, $4, $5, $6, $7, $#" + printChannelsHelp + fi + +} + +printChannelsHelp() { + echo "Channel management commands:" + echo "" + + echo "fablo channel list org1 peer0" + echo -e "\\t List channels on 'peer0' of 'Org1'". + echo "" + + echo "fablo channel getinfo my-channel1 org1 peer0" + echo -e "\\t Get channel info on 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer0 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer0 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". + echo "" + +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +generateArtifacts() { + printHeadline "Generating basic configs" "U1F913" + + printItalics "Generating crypto material for Orderer" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-orderer.yaml" "peerOrganizations/orderer.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating crypto material for Org1" "U1F512" + certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + + printItalics "Generating genesis block for group group1" "U1F3E0" + genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis" + + # Create directories to avoid permission errors on linux + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +startNetwork() { + printHeadline "Starting network" "U1F680" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts + sleep 4 +} + +generateChannelsArtifacts() { + printHeadline "Generating config for 'my-channel1'" "U1F913" + createChannelTx "my-channel1" "$FABLO_NETWORK_ROOT/fabric-config" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config/config" +} + +installChannels() { + printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + +} + +installChaincodes() { + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + local version="0.0.1" + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + else + echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + +} + +installChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + fi +} + +runDevModeChaincode() { + local chaincodeName=$1 + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + local version="0.0.1" + printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" + + fi +} + +upgradeChaincode() { + local chaincodeName="$1" + if [ -z "$chaincodeName" ]; then + echo "Error: chaincode name is not provided" + exit 1 + fi + + local version="$2" + if [ -z "$version" ]; then + echo "Error: chaincode version is not provided" + exit 1 + fi + + if [ "$chaincodeName" = "chaincode1" ]; then + if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then + printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" + chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + printHeadline "Installing 'chaincode1' for Org1" "U1F60E" + chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" + printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + + else + echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." + echo "Looked in dir: '$CHAINCODES_BASE_DIR/'" + fi + fi +} + +notifyOrgsAboutChannels() { + + printHeadline "Creating new channel config blocks" "U1F537" + createNewChannelUpdateTx "my-channel1" "Org1MSP" "MyChannel1" "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" + + printHeadline "Notyfing orgs about channels" "U1F4E2" + notifyOrgAboutNewChannelTls "my-channel1" "Org1MSP" "cli.org1.example.com" "peer0.org1.example.com" "orderer0.group1.orderer.example.com:7030" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + printHeadline "Deleting new channel config blocks" "U1F52A" + deleteNewChannelUpdateTx "my-channel1" "Org1MSP" "cli.org1.example.com" + +} + +printStartSuccessInfo() { + printHeadline "Done! Enjoy your fresh network" "U1F984" +} + +stopNetwork() { + printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) + sleep 4 +} + +networkDown() { + printf "Removing chaincode containers & images... \\U1F5D1 \\n" + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done + + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + + printf "Removing generated configs... \\U1F5D1 \\n" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" + rm -rf "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages" + + printHeadline "Done! Network was purged" "U1F5D1" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"networks: + basic: + +services: + + ca.orderer.example.com: + container_name: ca.orderer.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.orderer.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.orderer.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + ports: + - 7020:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORDERER_CA_ADMIN_NAME}:\${ORDERER_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + networks: + - basic + + cli.orderer.example.com: + container_name: cli.orderer.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.orderer.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=OrdererMSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/msp + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@orderer.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + orderer0.group1.orderer.example.com: + container_name: orderer0.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7030 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer0.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7030:7030 + - 8030:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + + ca.org1.example.com: + container_name: ca.org1.example.com + image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} + environment: + - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server + - FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com + - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server/crypto/ca.org1.example.com-cert.pem + - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server/crypto/priv-key.pem + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - FABRIC_CA_SERVER_TLS_ENABLED=true + - FABRIC_CA_SERVER_DB_TLS_ENABLED=false + - FABRIC_CA_SERVER_DB_TYPE=postgres + - FABRIC_CA_SERVER_DB_DATASOURCE=host=db.ca.org1.example.com port=5432 user=postgres password=caDbPass12345 dbname=fabriccaserver sslmode=disable + ports: + - 7040:7054 + working_dir: /etc/hyperledger/fabric-ca-server + command: sh -c 'fabric-ca-server start -b \${ORG1_CA_ADMIN_NAME}:\${ORG1_CA_ADMIN_PASSWORD} -d' + volumes: + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server/crypto + - ../fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml + depends_on: + db.ca.org1.example.com: + condition: service_healthy + networks: + - basic + + db.ca.org1.example.com: + container_name: db.ca.org1.example.com + image: postgres:\${FABRIC_CA_POSTGRES_VERSION} + environment: + - POSTGRES_PASSWORD=caDbPass12345 + - POSTGRES_USER=postgres + - POSTGRES_DB=fabriccaserver + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U postgres" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + cli.org1.example.com: + container_name: cli.org1.example.com + image: hyperledger/fabric-tools:\${FABRIC_TOOLS_VERSION} + tty: true + environment: + - GOPATH=/opt/gopath + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - CORE_PEER_ID=cli.org1.example.com + - CORE_CHAINCODE_KEEPALIVE=10 + # + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_MSPCONFIGPATH=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/msp + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.crt + - CORE_PEER_TLS_KEY_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/client.key + - CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/cli/crypto/users/Admin@org1.example.com/tls/ca.crt + - TLS_CA_CERT_PATH=/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem + working_dir: /var/hyperledger/cli/ + command: /bin/bash + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-docker/scripts/cli:/var/hyperledger/cli/scripts/ + - ../fabric-config/config:/var/hyperledger/cli/config/ # genesis.block and channel.tx's + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ + - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" + networks: + - basic + + fablo-rest.org1.example.com: + container_name: fablo-rest.org1.example.com + image: ghcr.io/fablo-io/fablo-rest:\${FABLO_REST_VERSION} + environment: + - PORT=8000 + - MSP_ID=Org1MSP + - FABRIC_CA_URL=https://ca.org1.example.com:7054 + - FABRIC_CA_NAME=ca.org1.example.com + - AS_LOCALHOST=false + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - HFC_LOGGING={"error":"console","warn":"console","info":"console"} + volumes: + # note: fablo needs access to all anchor peer certs + - ../fabric-config/crypto-config/peerOrganizations:/crypto:ro + ports: + - 8801:8000 + networks: + - basic + + peer0.org1.example.com: + container_name: peer0.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer0.org1.example.com + - CORE_PEER_ADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 + - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer0.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # CouchDB + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer0.org1.example.com:5984 + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer0 + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8041:9440 + - 7041:7041 + depends_on: + couchdb.peer0.org1.example.com: + condition: service_healthy + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + couchdb.peer0.org1.example.com: + container_name: couchdb.peer0.org1.example.com + image: couchdb:\${COUCHDB_VERSION} + environment: + - COUCHDB_USER=peer0 + - COUCHDB_PASSWORD=peer0Password + healthcheck: + test: "curl -f http://localhost:5984/" + interval: 5s + timeout: 10s + retries: 7 + ports: + - 5100:5984 + networks: + - basic + + db.explorer.example.com: + image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + container_name: db.explorer.example.com + environment: + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWORD=password + healthcheck: + test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" + interval: 5s + timeout: 10s + retries: 7 + volumes: + - /var/lib/postgresql/data + networks: + - basic + + explorer.example.com: + image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + restart: on-failure:8 + container_name: explorer.example.com + environment: + - DATABASE_HOST=db.explorer.example.com + - DATABASE_DATABASE=fabricexplorer + - DATABASE_USERNAME=hppoc + - DATABASE_PASSWD=password + - LOG_LEVEL_APP=debug + - LOG_LEVEL_DB=debug + - LOG_LEVEL_CONSOLE=info + - LOG_CONSOLE_STDOUT=true + - DISCOVERY_AS_LOCALHOST=false + volumes: + - ../fabric-config/explorer/config-global.json:/opt/explorer/app/platform/fabric/config.json + - ../fabric-config/explorer:/opt/explorer/app/platform/fabric/connection-profile + - ../fabric-config/crypto-config:/tmp/crypto + ports: + - "7010:8080" + depends_on: + db.explorer.example.com: + condition: service_healthy + networks: + - basic +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +certsGenerate() { + local CONTAINER_NAME=certsGenerate + + local CONFIG_PATH=$1 + local CRYPTO_CONFIG_FILE_NAME=$2 + local ORG_PATH=$3 + local OUTPUT_PATH=$4 + local FULL_CERT_PATH=$OUTPUT_PATH$ORG_PATH + + echo "Generating certs..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CRYPTO_CONFIG_FILE_NAME: $CRYPTO_CONFIG_FILE_NAME" + inputLog "ORG_PATH: $ORG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "FULL_CERT_PATH: $FULL_CERT_PATH" + + if [ -d "$FULL_CERT_PATH" ]; then + echo "Can't generate certs, directory already exists : $FULL_CERT_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME cryptogen generate --config=./fabric-config/"$CRYPTO_CONFIG_FILE_NAME" || removeContainer $CONTAINER_NAME + + docker cp $CONTAINER_NAME:/crypto-config/. "$OUTPUT_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME + + # shellcheck disable=2044 + for file in $(find "$OUTPUT_PATH"/ -iname '*_sk'); do + dir=$(dirname "$file") + mv "\${dir}"/*_sk "\${dir}"/priv-key.pem + done +} + +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + +genesisBlockCreate() { + local CONTAINER_NAME=genesisBlockCreate + + local CONFIG_PATH=$1 + local OUTPUT_PATH=$2 + local GENESIS_PROFILE_NAME=$3 + local GENESIS_FILE_NAME=$GENESIS_PROFILE_NAME.block + + echo "Creating genesis block..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "GENESIS_PROFILE_NAME: $GENESIS_PROFILE_NAME" + inputLog "GENESIS_FILE_NAME: $GENESIS_FILE_NAME" + + if [ -f "$OUTPUT_PATH/$GENESIS_FILE_NAME" ]; then + echo "Cant't generate genesis block, file already exists: $OUTPUT_PATH/$GENESIS_FILE_NAME" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "$GENESIS_PROFILE_NAME" -outputBlock "./config/$GENESIS_FILE_NAME" -channelID system-channel || removeContainer $CONTAINER_NAME + + mkdir -p "$OUTPUT_PATH" + docker cp "$CONTAINER_NAME:/config/$GENESIS_FILE_NAME" "$OUTPUT_PATH/$GENESIS_FILE_NAME" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createChannelTx() { + local CONTAINER_NAME=createChannelTx + + local CHANNEL_NAME=$1 + local CONFIG_PATH=$2 + local CONFIG_PROFILE=$3 + local OUTPUT_PATH=$4 + local CHANNEL_TX_PATH="$OUTPUT_PATH/$CHANNEL_NAME".tx + + echo "Creating channelTx for $CHANNEL_NAME..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "CHANNEL_TX_PATH: $CHANNEL_TX_PATH" + + if [ -f "$CHANNEL_TX_PATH" ]; then + echo "Can't create channel configuration, it already exists : $CHANNEL_TX_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME configtxgen --configPath ./fabric-config -profile "\${CONFIG_PROFILE}" -outputCreateChannelTx ./config/channel.tx -channelID "\${CHANNEL_NAME}" || removeContainer $CONTAINER_NAME + docker cp $CONTAINER_NAME:/config/channel.tx "$CHANNEL_TX_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +createNewChannelUpdateTx() { + local CONTAINER_NAME=createAnchorPeerUpdateTx + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CONFIG_PROFILE=$3 + local CONFIG_PATH=$4 + local OUTPUT_PATH=$5 + + ANCHOR_PEER_UPDATE_PATH="$OUTPUT_PATH/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + OUTPUT_ANCHOR_PEERS_UPDATE_PATH="./config/\${MSP_NAME}anchors.tx" + CONTAINER_COPY_PATH="\${CONTAINER_NAME}:/config/\${MSP_NAME}anchors.tx" + + echo "Creating new channel config block. Channel: $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CONFIG_PROFILE: $CONFIG_PROFILE" + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -f "$ANCHOR_PEER_UPDATE_PATH" ]; then + echo "Cant't create anchor peer update, it already exists : $ANCHOR_PEER_UPDATE_PATH" + echo "Try using 'reset' or 'down' to remove whole network or 'start' to reuse it" + exit 1 + fi + + docker run -i -d -w="/" --name $CONTAINER_NAME hyperledger/fabric-tools:"\${FABRIC_TOOLS_VERSION}" bash || removeContainer $CONTAINER_NAME + docker cp "$CONFIG_PATH" $CONTAINER_NAME:/fabric-config || removeContainer $CONTAINER_NAME + + docker exec -i $CONTAINER_NAME mkdir /config || removeContainer $CONTAINER_NAME + docker exec -i $CONTAINER_NAME configtxgen \\ + --configPath ./fabric-config \\ + -profile "\${CONFIG_PROFILE}" \\ + -outputAnchorPeersUpdate "\${OUTPUT_ANCHOR_PEERS_UPDATE_PATH}" \\ + -channelID "\${CHANNEL_NAME}" \\ + -asOrg "\${MSP_NAME}" || removeContainer $CONTAINER_NAME + + docker cp "$CONTAINER_COPY_PATH" "$ANCHOR_PEER_UPDATE_PATH" || removeContainer $CONTAINER_NAME + + removeContainer $CONTAINER_NAME +} + +notifyOrgAboutNewChannel() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +notifyOrgAboutNewChannelTls() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local PEER_ADDRESS=$4 + local ORDERER_URL=$5 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + local CA_CERT="/var/hyperledger/cli/"\${6} + + echo "Updating channel $CHANNEL_NAME for organization $MSP_NAME (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "MSP_NAME: $MSP_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel update \\ + -c "$CHANNEL_NAME" \\ + -o "$ORDERER_URL" \\ + -f "$ANCHOR_PEER_UPDATE_PATH" \\ + --tls --cafile "$CA_CERT" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +deleteNewChannelUpdateTx() { + local CHANNEL_NAME=$1 + local MSP_NAME=$2 + local CLI_NAME=$3 + local ANCHOR_PEER_UPDATE_PATH="/var/hyperledger/cli/config/\${MSP_NAME}anchors-$CHANNEL_NAME.tx" + + echo "Deleting new channel config block. Channel: $CHANNEL_NAME, Organization: $MSP_NAME" + inputLogShort "CHANNEL_NAME: $CHANNEL_NAME, MSP_NAME: $MSP_NAME, CLI_NAME: $CLI_NAME, ANCHOR_PEER_UPDATE_PATH: $ANCHOR_PEER_UPDATE_PATH" + + if [ -n "$ANCHOR_PEER_UPDATE_PATH" ]; then + docker exec "$CLI_NAME" rm "$ANCHOR_PEER_UPDATE_PATH" + else + echo "channel update tx not found! Looked for: $ANCHOR_PEER_UPDATE_PATH" + fi +} + +printHeadline() { + bold=$'\\e[1m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${bold}============ %b %s %b ==============\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +printItalics() { + italics=$'\\e[3m' + end=$'\\e[0m' + + TEXT=$1 + EMOJI=$2 + printf "\${italics}==== %b %s %b ====\${end}\\n" "\\\\$EMOJI" "$TEXT" "\\\\$EMOJI" +} + +inputLog() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +inputLogShort() { + end=$'\\e[0m' + darkGray=$'\\e[90m' + + echo "\${darkGray} $1 \${end}" +} + +certsRemove() { + local CERTS_DIR_PATH=$1 + rm -rf "$CERTS_DIR_PATH" +} + +removeContainer() { + CONTAINER_NAME=$1 + docker rm -f "$CONTAINER_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +printHelp() { + echo "Fablo is powered by SoftwareMill" + + echo "" + echo "usage: ./fabric-docker.sh " + echo "" + + echo "Commands: " + echo "" + echo "./fabric-docker.sh up" + echo -e "\\t Use for first run. Creates all needed artifacts (certs, genesis block) and starts network for the first time." + echo -e "\\t After 'up' commands start/stop are used to manage network and rerun to rerun it" + echo "" + echo "./fabric-docker.sh down" + echo -e "\\t Back to empty state - destorys created containers, prunes generated certificates, configs." + echo "" + echo "./fabric-docker.sh start" + echo -e "\\t Starts already created network." + echo "" + echo "./fabric-docker.sh stop" + echo -e "\\t Stops already running network." + echo "" + echo "./fabric-docker.sh reset" + echo -e "\\t Fresh start - it destroys whole network, certs, configs and then reruns everything." + echo "" + echo "./fabric-docker.sh channel --help" + echo -e "\\t Detailed help for channel management scripts." + echo "" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash +# phrase "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" is needed in older bash versions ( <4 ) for array expansion. +# see: https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u + +dockerPullIfMissing() { + local IMAGE="$1" + if [[ "$(docker images -q "$IMAGE" 2>/dev/null)" == "" ]]; then + docker pull --platform linux/x86_64 "$IMAGE" + fi +} + +node_version_check() { + local fabric_shim_version="$1" + local nodejs_version + + if [[ "$fabric_shim_version" == *"1.4."* ]]; then + nodejs_version=8.9 + + elif [[ "$fabric_shim_version" == *"2.2."* || "$fabric_shim_version" == *"2.3."* ]]; then + nodejs_version=12.13 + + elif [[ "$fabric_shim_version" == *"2.4."* ]]; then + nodejs_version=16.16 + + elif [[ "$fabric_shim_version" == *"2.5."* ]]; then + nodejs_version=18.12 + + else + nodejs_version=18.12 + fi + + echo $nodejs_version +} + +chaincodeBuild() { + local CHAINCODE_NAME=$1 + local CHAINCODE_LANG=$2 + local CHAINCODE_DIR_PATH=$3 + local RECOMMENDED_NODE_VERSION=$4 + + mkdir -p "$CHAINCODE_DIR_PATH" + + # pull required images upfront in case of arm64 (Apple Silicon) architecture + # see https://stackoverflow.com/questions/69699421/hyperledger-fabric-chaincode-installation-failed-no-matching-manifest-for-linu + # also, starting from Fabric 2.5, the base images for chaincode are available for arm64, so we don't need to pull them separately + # and we use \`sort -V\` to compare versions, because \`sort\` handles versions like \`2.4\` and \`2.10\` correctly + if [ "$(uname -m)" = "arm64" ] && [ "$(printf '%s\\n' "$FABRIC_VERSION" "2.5" | sort -V | head -n1)" = "$FABRIC_VERSION" ]; then + if [ "$CHAINCODE_LANG" = "node" ]; then + dockerPullIfMissing "hyperledger/fabric-nodeenv:$FABRIC_NODEENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "java" ]; then + dockerPullIfMissing "hyperledger/fabric-javaenv:$FABRIC_JAVAENV_VERSION" + fi + if [ "$CHAINCODE_LANG" = "golang" ]; then + dockerPullIfMissing "hyperledger/fabric-baseos:$FABRIC_BASEOS_VERSION" + fi + fi + + if [ "$CHAINCODE_LANG" = "node" ]; then + NODE_VERSION=$(node --version) + fabric_shim_version=$(jq -r '.dependencies."fabric-shim"' "$CHAINCODE_DIR_PATH/package.json") + RECOMMENDED_NODE_VERSION=$(node_version_check "$fabric_shim_version") + + if ! echo "$NODE_VERSION" | grep -q "v$RECOMMENDED_NODE_VERSION"; then + echo "Warning: Your Node.js version is $NODE_VERSION, but recommended is $RECOMMENDED_NODE_VERSION)" + echo "See: https://github.com/hyperledger/fabric-chaincode-node/blob/main/COMPATIBILITY.md" + fi + + echo "Buiding chaincode '$CHAINCODE_NAME'..." + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "CHAINCODE_DIR_PATH: $CHAINCODE_DIR_PATH" + inputLog "NODE_VERSION: $NODE_VERSION (recommended: $RECOMMENDED_NODE_VERSION)" + + # Default to using npm for installation and build + (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) + fi +} + +chaincodePackage() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_LANG=$5 + + echo "Packaging chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "CHAINCODE_LANG: $CHAINCODE_LANG" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode package \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + --path "/var/hyperledger/cli/$CHAINCODE_NAME/" \\ + --lang "$CHAINCODE_LANG" \\ + --label "$CHAINCODE_LABEL" + + # set package owner as current (host) user to fix permission issues + docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + +chaincodeInstall() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CA_CERT=$5 + + echo "Installing chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA_CERT: $CA_CERT" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tlsRootCertFiles "/var/hyperledger/cli/$CA_CERT") + fi + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode install \\ + "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + +chaincodeApprove() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COLLECTIONS_CONFIG=\${10} + + echo "Approving chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYINSTALLED_RESPONSE + local CC_PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" + CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" + fi + inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" -e CC_PACKAGE_ID="$CC_PACKAGE_ID" "$CLI_NAME" peer lifecycle chaincode approveformyorg \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --package-id "$CC_PACKAGE_ID" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +chaincodeCommit() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME="$3" + local CHAINCODE_NAME=$4 + local CHAINCODE_VERSION=$5 + local ORDERER_URL=$6 + local ENDORSEMENT=$7 + local INIT_REQUIRED=$8 + local CA_CERT=$9 + local COMMIT_PEER_ADDRESSES=\${10} + local TLS_ROOT_CERT_FILES=\${11} + local COLLECTIONS_CONFIG=\${12} + + echo "Committing chaincode $CHAINCODE_NAME..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "ORDERER_URL: $ORDERER_URL" + inputLog "ENDORSEMENT: $ENDORSEMENT" + inputLog "INIT_REQUIRED: $INIT_REQUIRED" + inputLog "CA_CERT: $CA_CERT" + inputLog "COMMIT_PEER_ADDRESSES: $COMMIT_PEER_ADDRESSES" + inputLog "TLS_ROOT_CERT_FILES: $TLS_ROOT_CERT_FILES" + inputLog "COLLECTIONS_CONFIG: $COLLECTIONS_CONFIG" + + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local COMMIT_PEER_PARAMS=() + if [ -n "$COMMIT_PEER_ADDRESSES" ]; then + # shellcheck disable=SC2207 + COMMIT_PEER_PARAMS=($(echo ",$COMMIT_PEER_ADDRESSES" | sed 's/,/ --peerAddresses /g')) + fi + + local TLS_ROOT_CERT_PARAMS=() + if [ -n "$TLS_ROOT_CERT_FILES" ]; then + # shellcheck disable=SC2207 + TLS_ROOT_CERT_PARAMS=(--tls $(echo ",$TLS_ROOT_CERT_FILES" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')) + fi + + local ENDORSEMENT_PARAMS=() + if [ -n "$ENDORSEMENT" ]; then + ENDORSEMENT_PARAMS=(--signature-policy "$ENDORSEMENT") + fi + + local INIT_REQUIRED_PARAMS=() + if [ "$INIT_REQUIRED" = "true" ]; then + INIT_REQUIRED_PARAMS=(--init-required) + fi + + local COLLECTIONS_CONFIG_PARAMS=() + if [ -n "$COLLECTIONS_CONFIG" ]; then + COLLECTIONS_CONFIG_PARAMS=(--collections-config "$COLLECTIONS_CONFIG") + fi + + local QUERYCOMMITTED_RESPONSE + local SEQUENCE + + QUERYCOMMITTED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + SEQUENCE="$(jq ".chaincode_definitions | [.[]? | select(.name==\\"$CHAINCODE_NAME\\").sequence ] | max | select(.!= null)" -r <<<"$QUERYCOMMITTED_RESPONSE")" + SEQUENCE=$((SEQUENCE + 1)) + inputLog "SEQUENCE: $SEQUENCE" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode commit \\ + -o "$ORDERER_URL" \\ + -C "$CHANNEL_NAME" \\ + -n "$CHAINCODE_NAME" \\ + -v "$CHAINCODE_VERSION" \\ + --sequence "$SEQUENCE" \\ + "\${ENDORSEMENT_PARAMS[@]+"\${ENDORSEMENT_PARAMS[@]}"}" \\ + "\${INIT_REQUIRED_PARAMS[@]+"\${INIT_REQUIRED_PARAMS[@]}"}" \\ + "\${COLLECTIONS_CONFIG_PARAMS[@]+"\${COLLECTIONS_CONFIG_PARAMS[@]}"}" \\ + "\${COMMIT_PEER_PARAMS[@]+"\${COMMIT_PEER_PARAMS[@]}"}" \\ + "\${TLS_ROOT_CERT_PARAMS[@]+"\${TLS_ROOT_CERT_PARAMS[@]}"}" \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" +} + +peerChaincodeList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + + # Execute the command to list chaincodes + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" +} + +peerChaincodeListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHANNEL_NAME=$3 + local CA_CERT=$4 + + echo "Chaincodes list:" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CA_CERT: $CA_CERT" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode querycommitted \\ + --channelID "$CHANNEL_NAME" \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" +} + +# Function to perform chaincode invoke +peerChaincodeInvoke() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + 2>&1 +} +# Function to perform chaincode invoke for Tls +peerChaincodeInvokeTls() { + local CLI="$1" + local PEERS="$2" + local CHANNEL="$3" + local CHAINCODE="$4" + local COMMAND="$5" + local TRANSIENT="$6" + local PEER_CERTS="$7" + local CA_CERT="$8" + + echo "Chaincode invoke:" + inputLog "CLI: $CLI" + inputLog "PEERS: $PEERS" + inputLog "CHANNEL: $CHANNEL" + inputLog "CHAINCODE: $CHAINCODE" + inputLog "COMMAND: $COMMAND" + inputLog "TRANSIENT: $TRANSIENT" + inputLog "PEER_CERTS: $PEER_CERTS" + inputLog "CA_CERT: $CA_CERT" + + PEER_ADDRESSES="--peerAddresses $(echo "$PEERS" | sed 's/,/ --peerAddresses /g')" + + TLS_ROOT_CERT_FILES="--tlsRootCertFiles /var/hyperledger/cli/$(echo "$PEER_CERTS" | sed 's/,/ --tlsRootCertFiles \\/var\\/hyperledger\\/cli\\//g')" + + # shellcheck disable=SC2086 + docker exec "$CLI" peer chaincode invoke \\ + $PEER_ADDRESSES \\ + $TLS_ROOT_CERT_FILES \\ + -C "$CHANNEL" \\ + -n "$CHAINCODE" \\ + -c "$COMMAND" \\ + --transient "$TRANSIENT" \\ + --waitForEvent \\ + --waitForEventTimeout 90s \\ + --tls \\ + --cafile "/var/hyperledger/cli/$CA_CERT" \\ + 2>&1 +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +peerChannelList() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list +} + +peerChannelGetInfo() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" +} + +peerChannelFetchConfig() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlock() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local TARGET_FILE="$5" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} + +#=== TLS equivalents ========================================================= + +peerChannelListTls() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CA_CERT=$3 + + echo "Listing channels using $CLI_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel list --tls --cafile "$CA_CERT" +} + +peerChannelGetInfoTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local PEER_ADDRESS=$3 + local CA_CERT=$4 + + echo "Getting info about $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer channel getinfo \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" +} + +peerChannelFetchConfigTls() { + local CHANNEL_NAME=$1 + local CLI_NAME=$2 + local CONFIG_FILE_NAME=$3 + local PEER_ADDRESS=$4 + local CA_CERT=$5 + + echo "Fetching config block from $CHANNEL_NAME using peer $PEER_ADDRESS (TLS)..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CONFIG_FILE_NAME: $CONFIG_FILE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/assets/ + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch config /tmp/hyperledger/assets/config_block_before.pb \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" chmod 777 /tmp/hyperledger/assets/config_block_before.pb + docker exec \\ + -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" configtxlator proto_decode \\ + --input /tmp/hyperledger/assets/config_block_before.pb \\ + --type common.Block | + jq .data.data[0].payload.data.config >"$CONFIG_FILE_NAME" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/assets/ +} + +peerChannelFetchBlockTls() { + local CHANNEL_NAME="$1" + local CLI_NAME="$2" + local BLOCK_NAME="$3" + local PEER_ADDRESS="$4" + local CA_CERT="$5" + local TARGET_FILE="$6" + local TEMP_FILE="/tmp/hyperledger/blocks/$BLOCK_NAME.block" + + echo "Fetching block $BLOCK_NAME from $CHANNEL_NAME using peer $PEER_ADDRESS..." + inputLog "CHANNEL_NAME: $CHANNEL_NAME" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "BLOCK_NAME: $BLOCK_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "TARGET_FILE: $TARGET_FILE" + + docker exec "$CLI_NAME" mkdir -p /tmp/hyperledger/blocks/ + + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" \\ + "$CLI_NAME" peer channel fetch "$BLOCK_NAME" "$TEMP_FILE" \\ + -c "$CHANNEL_NAME" --tls --cafile "$CA_CERT" + + docker exec "$CLI_NAME" cat "$TEMP_FILE" >"$TARGET_FILE" + + docker exec "$CLI_NAME" rm -rf /tmp/hyperledger/blocks/ +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +set -eu + +createChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-createChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx + peer channel join -b "\${CHANNEL_NAME}".block + + rm -rf "$DIR_NAME" +} + +createChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-createChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Creating channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + cp /var/hyperledger/cli/config/"$CHANNEL_NAME".tx . + + peer channel create -o "\${ORDERER_URL}" -c "\${CHANNEL_NAME}" -f ./"$CHANNEL_NAME".tx --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}".block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoin() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local ORDERER_URL=$5 + + local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name: \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" + peer channel join -b "\${CHANNEL_NAME}"_newest.block + + rm -rf "$DIR_NAME" +} + +fetchChannelAndJoinTls() { + local CHANNEL_NAME=$1 + local CORE_PEER_LOCALMSPID=$2 + local CORE_PEER_ADDRESS=$3 + local CORE_PEER_MSPCONFIGPATH=$(realpath "$4") + local CORE_PEER_TLS_MSPCONFIGPATH=$(realpath "$5") + local TLS_CA_CERT_PATH=$(realpath "$6") + local ORDERER_URL=$7 + + local CORE_PEER_TLS_CERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.crt + local CORE_PEER_TLS_KEY_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/client.key + local CORE_PEER_TLS_ROOTCERT_FILE=$CORE_PEER_TLS_MSPCONFIGPATH/ca.crt + + local DIR_NAME=step-fetchChannelAndJoinTls-$CHANNEL_NAME-$CORE_PEER_ADDRESS + + echo "Fetching channel with name (TLS): \${CHANNEL_NAME}" + echo " Orderer: $ORDERER_URL" + echo " CORE_PEER_LOCALMSPID: $CORE_PEER_LOCALMSPID" + echo " CORE_PEER_ADDRESS: $CORE_PEER_ADDRESS" + echo " CORE_PEER_MSPCONFIGPATH: $CORE_PEER_MSPCONFIGPATH" + echo " TLS_CA_CERT_PATH is: $TLS_CA_CERT_PATH" + echo " CORE_PEER_TLS_CERT_FILE: $CORE_PEER_TLS_CERT_FILE" + echo " CORE_PEER_TLS_KEY_FILE: $CORE_PEER_TLS_KEY_FILE" + echo " CORE_PEER_TLS_ROOTCERT_FILE: $CORE_PEER_TLS_ROOTCERT_FILE" + + mkdir "$DIR_NAME" && cd "$DIR_NAME" + + peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH" + peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH" + + rm -rf "$DIR_NAME" +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +__getOrdererAndPeerNodes() { + echo " + orderer0.group1.orderer.example.com + peer0.org1.example.com + " +} + +__getCASQLiteNodes() { + echo " + ca.orderer.example.com + " +} + +__getCAPostgresNodes() { + echo " + db.ca.org1.example.com + " +} + +__createSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + backup_dir="\${1:-"snapshot-$(date -u +"%Y%m%d%H%M%S")"}" + + if [ -d "$backup_dir" ] && [ "$(ls -A "$backup_dir")" ]; then + echo "Error: Directory '$backup_dir' already exists and is not empty!" + exit 1 + fi + + mkdir -p "$backup_dir" + cp -R ./fablo-target "$backup_dir/" + + for node in $(__getCASQLiteNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node" + docker cp "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" "$backup_dir/$node/fabric-ca-server.db" + done + + for node in $(__getCAPostgresNodes); do + echo "Saving state of $node..." + mkdir -p "$backup_dir/$node/pg-data" + docker exec "$node" pg_dump -c --if-exists -U postgres fabriccaserver >"$backup_dir/$node/fabriccaserver.sql" + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Saving state of $node..." + docker cp "$node:/var/hyperledger/production/" "$backup_dir/$node/" + done +} + +__cloneSnapshot() { + cd "$FABLO_NETWORK_ROOT/.." + target_dir="$1" + hook_cmd="$2" + + if [ -d "$target_dir/fablo-target" ]; then + echo "Error: Directory '$target_dir/fablo-target' already exists! Execute 'fablo prune' to remove the current network." + exit 1 + fi + + cp -R ./fablo-target "$target_dir/fablo-target" + + if [ -n "$hook_cmd" ]; then + echo "Executing pre-restore hook: '$hook_cmd'" + (cd "$target_dir" && eval "$hook_cmd") + fi + + (cd "$target_dir/fablo-target/fabric-docker" && docker compose up --no-start) + + for node in $(__getCASQLiteNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabric-ca-server.db" "$node:/etc/hyperledger/fabric-ca-server/fabric-ca-server.db" + fi + done + + for node in $(__getCAPostgresNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/fabriccaserver.sql" "$node:/docker-entrypoint-initdb.d/fabriccaserver.sql" + fi + done + + for node in $(__getOrdererAndPeerNodes); do + echo "Restoring $node..." + if [ ! -d "$node" ]; then + echo "Warning: Cannot restore '$node', directory does not exist!" + else + docker cp "./$node/" "$node:/var/hyperledger/production/" + fi + done +} + +createSnapshot() { + (set -eu && __createSnapshot "$1") +} + +cloneSnapshot() { + (set -eu && __cloneSnapshot "$1" "$2") +} +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"#!/usr/bin/env bash + +# The code from this file was called after Fablo generated Hyperledger Fabric configuration +echo "Executing post-generate hook" + +perl -i -pe 's/MaxMessageCount: 10/MaxMessageCount: 1/g' "./fablo-target/fabric-config/configtx.yaml" +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +"graph TD + + subgraph Org_Orderer [Org: Orderer] + CA_ca_Orderer[CA: ca_Orderer - sqlite] + end + + subgraph Org_Org1 [Org: Org1] + CA_ca_Org1[CA: ca_Org1 - postgres] + Org1_peer0[Peer: peer0] + end + + subgraph Channel_my_channel1 [Channel: my-channel1] + Chaincode_chaincode1[Chaincode: chaincode1] + end + + %% Connections + Org_Orderer --> Channel_my_channel1 + Org_Org1 -.-> Channel_my_channel1 + Org1_peer0 --> Channel_my_channel1 +" +`; + +exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should create proper files from samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json 1`] = ` +[ + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/.gitignore", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/configtx.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/connection-profiles/connection-profile-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-orderer.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/crypto-config-org1.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-global.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/config-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/explorer/connection-profile-org1.json", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/orderer.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-config/fabric-ca-server-config/org1.example.com/fabric-ca-server-config.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/.env", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/chaincode-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/channel-query-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/commands-generated.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/docker-compose.yaml", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/base-help.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/chaincode-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/channel-query-functions.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/scripts/cli/channel_fns.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/fabric-docker/snapshot-scripts.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/hooks/post-generate.sh", + "e2e/__tmp__/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.tmpdir/fablo-target/network-topology.mmd", +] +`; diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 989a10de6..ef75fd6ae 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1438,7 +1438,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode.json should create proper e2e "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -1651,6 +1651,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1675,7 +1677,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" else @@ -1705,7 +1707,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1726,7 +1728,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1753,7 +1755,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1783,32 +1785,33 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -1972,6 +1975,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2016,6 +2021,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2073,6 +2080,70 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2343,7 +2414,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2364,7 +2434,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2409,7 +2478,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2437,6 +2505,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2460,6 +2592,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2515,6 +2723,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 464c752e9..5ebb8feee 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2099,7 +2099,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -2365,6 +2365,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -2391,10 +2393,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" else @@ -2408,10 +2410,10 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" else @@ -2441,10 +2443,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2460,10 +2462,10 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2484,9 +2486,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "or-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'or-policy-chaincode' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" printHeadline "Approving 'or-policy-chaincode' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2494,9 +2496,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "and-policy-chaincode" ]; then local version="0.0.1" printHeadline "Approving 'and-policy-chaincode' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" printHeadline "Approving 'and-policy-chaincode' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "0.0.1" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2523,10 +2525,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "node" printHeadline "Installing 'or-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "or-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printHeadline "Installing 'or-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "or-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/or-policy-chaincode.json" "node" "" printItalics "Committing chaincode 'or-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "or-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "OR('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/or-policy-chaincode.json" @@ -2542,10 +2544,10 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "golang" printHeadline "Installing 'and-policy-chaincode' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "and-policy-chaincode" "$version" "" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printHeadline "Installing 'and-policy-chaincode' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7061" "and-policy-chaincode" "$version" "" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7061" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "collections/and-policy-chaincode.json" "golang" "" printItalics "Committing chaincode 'and-policy-chaincode' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "and-policy-chaincode" "$version" "orderer0.group1.orderer.example.com:7030" "AND('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7041,peer0.org2.example.com:7061" "" "collections/and-policy-chaincode.json" @@ -2578,64 +2580,65 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com-or-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-or-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com-or-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer1.org1.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com-and-policy-chaincode" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-and-policy-chaincode*" -q); do + for image in $(docker images "peer0.org2.example.com-and-policy-chaincode*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2805,6 +2808,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2849,6 +2854,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2942,6 +2949,8 @@ services: - GODEBUG=netdns=go # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2999,6 +3008,70 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -3269,7 +3342,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -3290,7 +3362,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -3335,7 +3406,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -3363,6 +3433,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3386,6 +3520,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -3441,6 +3651,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index a5855968c..7cb0a10be 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3022,7 +3022,7 @@ exports[`samples/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml should create pro "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3467,6 +3467,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3508,10 +3510,10 @@ installChaincodes() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" else @@ -3524,10 +3526,10 @@ installChaincodes() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" else @@ -3556,10 +3558,10 @@ installChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3574,10 +3576,10 @@ installChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3598,9 +3600,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printHeadline "Approving 'chaincode1' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "" "" @@ -3608,9 +3610,9 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode2" ]; then local version="0.0.1" printHeadline "Approving 'chaincode2' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printHeadline "Approving 'chaincode2' for Org2 (dev mode)" "U1F60E" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "0.0.1" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "" "" @@ -3636,10 +3638,10 @@ upgradeChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7061" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printHeadline "Installing 'chaincode1' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer0.org2.example.com:7081" "chaincode1" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer0.org2.example.com:7081" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7061" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer0.org1.example.com:7061,peer0.org2.example.com:7081" "crypto-peer/peer0.org1.example.com/tls/ca.crt,crypto-peer/peer0.org2.example.com/tls/ca.crt" "" @@ -3654,10 +3656,10 @@ upgradeChaincode() { chaincodeBuild "chaincode2" "java" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-java-simple" "16" chaincodePackage "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "java" printHeadline "Installing 'chaincode2' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7062" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printHeadline "Installing 'chaincode2' for Org2" "U1F60E" chaincodeInstall "cli.org2.example.com" "peer1.org2.example.com:7082" "chaincode2" "$version" "crypto-orderer/tlsca.orderer1.com-cert.pem" - chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" + chaincodeApprove "cli.org2.example.com" "peer1.org2.example.com:7082" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "" "java" "" printItalics "Committing chaincode 'chaincode2' on channel 'my-channel2' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer1.org1.example.com:7062" "my-channel2" "chaincode2" "$version" "orderer0.group1.orderer1.com:7030" "OR ('Org1MSP.member', 'Org2MSP.member')" "false" "crypto-orderer/tlsca.orderer1.com-cert.pem" "peer1.org1.example.com:7062,peer1.org2.example.com:7082" "crypto-peer/peer1.org1.example.com/tls/ca.crt,crypto-peer/peer1.org2.example.com/tls/ca.crt" "" @@ -3702,48 +3704,49 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer0.org2.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org2.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org2.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org2.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org2.example.com-chaincode2" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org2.example.com-chaincode2" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org2.example.com-chaincode2*" -q); do + for image in $(docker images "peer1.org2.example.com-chaincode2*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -4136,6 +4139,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4185,6 +4190,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4294,6 +4301,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4343,6 +4352,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4400,6 +4411,70 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -4670,7 +4745,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -4691,7 +4765,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -4736,7 +4809,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -4764,6 +4836,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4787,6 +4923,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -4842,6 +5054,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 85ff1963e..a8770b215 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3317,7 +3317,7 @@ exports[`samples/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json should cr "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -3801,6 +3801,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3843,7 +3845,7 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else @@ -3873,7 +3875,7 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3894,7 +3896,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -3921,7 +3923,7 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -3960,32 +3962,33 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -4303,6 +4306,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4350,6 +4355,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4532,6 +4539,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4579,6 +4588,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org2"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4761,6 +4772,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4808,6 +4821,8 @@ services: - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org3"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -4823,14 +4838,14 @@ services: - basic db.explorer.example.com: - image: hyperledger/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} container_name: db.explorer.example.com environment: - DATABASE_DATABASE=fabricexplorer - DATABASE_USERNAME=hppoc - DATABASE_PASSWORD=password healthcheck: - test: "pg_isready -h localhost -p 5432 -q -U postgres" + test: "pg_isready -h localhost -p 5432 -q -U hppoc -d fabricexplorer" interval: 5s timeout: 10s retries: 7 @@ -4840,7 +4855,7 @@ services: - basic explorer.example.com: - image: hyperledger/explorer:\${HYPERLEDGER_EXPLORER_VERSION} + image: ghcr.io/hyperledger-labs/explorer:\${HYPERLEDGER_EXPLORER_VERSION} restart: on-failure:8 container_name: explorer.example.com environment: @@ -4908,6 +4923,70 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -5178,7 +5257,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -5199,7 +5277,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -5244,7 +5321,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -5272,6 +5348,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5295,6 +5435,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -5350,6 +5566,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index da334dbdb..4f82f5e54 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1514,7 +1514,7 @@ exports[`samples/fablo-config-hlf3-1orgs-1chaincode.json should create proper e2 "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -1731,6 +1731,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1760,9 +1762,9 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1790,9 +1792,9 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1826,9 +1828,9 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1849,32 +1851,33 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2208,6 +2211,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2257,6 +2262,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2314,6 +2321,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2590,7 +2638,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2611,7 +2658,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2656,7 +2702,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2684,6 +2729,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2707,6 +2816,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2762,6 +2947,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index b17714cd7..3cd4231fe 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1539,7 +1539,7 @@ exports[`samples/fablo-config-hlf3-bft-1orgs-1chaincode.json should create prope "FABLO_VERSION=2.2.0 FABLO_BUILD= FABLO_REST_VERSION=0.1.2 -HYPERLEDGER_EXPLORER_VERSION=1.1.8 +HYPERLEDGER_EXPLORER_VERSION=2.0.0 COUCHDB_VERSION=3.1 FABRIC_COUCHDB_VERSION=0.4.18 @@ -1756,6 +1756,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1784,9 +1786,9 @@ installChaincodes() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' installation. Chaincode directory is empty." echo "Looked in dir: '$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node'" @@ -1814,9 +1816,9 @@ installChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' install. Chaincode directory is empty." @@ -1850,9 +1852,9 @@ upgradeChaincode() { chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" - chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "undefined" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" + chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "AND ('Org1MSP.member')" "" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" else echo "Warning! Skipping chaincode 'chaincode1' upgrade. Chaincode directory is empty." @@ -1873,32 +1875,33 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "dev-peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer1.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -2232,6 +2235,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2281,6 +2286,8 @@ services: - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start ports: @@ -2338,6 +2345,47 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2614,7 +2662,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2635,7 +2682,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2680,7 +2726,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2708,6 +2753,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2731,6 +2840,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2786,6 +2971,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index d6f843437..2021de2b9 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,6 +4,9 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== +Validation errors count: 0 +Validation warnings count: 0 +=========================================================== { "global": { "fabricVersion": "2.4.3", @@ -2009,6 +2012,7 @@ Validation warnings count: 0 } } }, + "peerChaincodeInstances": [], "privateData": [] }, { @@ -2455,6 +2459,7 @@ Validation warnings count: 0 } } }, + "peerChaincodeInstances": [], "privateData": [] } ], @@ -2469,12 +2474,20 @@ Validation warnings count: 0 exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 -Validation warnings count: 0 +Validation warnings count: 1 +=========================================================== +Validation errors count: 0 +Validation warnings count: 1 +=========================================================== +=================== Validation summary ==================== +Warnings found: + Orderer: + - Orderer consesus type is set to 'raft', but number of instances is 1. Network won't be fault tolerant! Consider higher value. =========================================================== { "global": { "fabricVersion": "2.5.12", - "tls": false, + "tls": true, "peerDevMode": false, "engine": "docker", "fabricToolsVersion": "2.5.12", @@ -2503,7 +2516,7 @@ Validation warnings count: 0 "ordererGroups": [ { "name": "group1", - "consensus": "solo", + "consensus": "etcdraft", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2517,7 +2530,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2530,7 +2543,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2542,7 +2555,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2556,7 +2569,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2588,7 +2601,7 @@ Validation warnings count: 0 "ordererGroups": [ { "name": "group1", - "consensus": "solo", + "consensus": "etcdraft", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2602,7 +2615,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2615,7 +2628,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2808,7 +2821,7 @@ Validation warnings count: 0 ], "ordererGroup": { "name": "group1", - "consensus": "solo", + "consensus": "etcdraft", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2822,7 +2835,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2835,7 +2848,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2847,7 +2860,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2859,7 +2872,7 @@ Validation warnings count: 0 "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "solo", + "consensus": "etcdraft", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2968,7 +2981,7 @@ exports[`init should init simple fablo config 1`] = ` "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": false, + "tls": true, "peerDevMode": false, "engine": "docker" }, @@ -2986,7 +2999,7 @@ exports[`init should init simple fablo config 1`] = ` "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1, "prefix": "orderer" } @@ -3036,7 +3049,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": false, + "tls": true, "peerDevMode": false, "engine": "docker" }, @@ -3054,7 +3067,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1, "prefix": "orderer" } @@ -3098,9 +3111,9 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "privateData": [] } ], @@ -3113,7 +3126,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": false, + "tls": true, "peerDevMode": false, "engine": "docker" }, @@ -3131,7 +3144,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "orderers": [ { "groupName": "group1", - "type": "solo", + "type": "raft", "instances": 1, "prefix": "orderer" } @@ -3179,9 +3192,9 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 { "name": "chaincode1", "version": "0.0.1", - "lang": "node", + "lang": "ccaas", "channel": "my-channel1", - "directory": "./chaincodes/chaincode-kv-node", + "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", "privateData": [] } ], From 1a4eebf36e78f185d94da1bcd406855b45a0236f Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 21 Aug 2025 07:52:51 -0500 Subject: [PATCH 462/471] fix-increase instances for fault tolerance warning Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/extendConfig.test.ts.snap | 368 +++++++++++++++--- ...1chaincode-peer-dev-mode.json.test.ts.snap | 231 ++++++++++- ...1chaincode-raft-explorer.json.test.ts.snap | 204 +++++++++- ...ig-hlf2-1org-1chaincode-raft-explorer.json | 4 +- 4 files changed, 738 insertions(+), 69 deletions(-) diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 10f9a1996..1dd707851 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -1890,6 +1890,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j }, "directory": "./chaincodes/chaincode-kv-node", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -1975,6 +1976,7 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.j }, "lang": "node", "name": "chaincode1", + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", @@ -2473,8 +2475,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2521,13 +2536,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2585,6 +2600,17 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -2615,8 +2641,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2663,13 +2702,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2704,8 +2743,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2752,13 +2804,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2803,8 +2855,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2851,13 +2916,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2915,6 +2980,17 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -2945,8 +3021,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2993,13 +3082,13 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -3109,6 +3198,17 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -3169,6 +3269,17 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "OrdererMSP", + "orgName": "Orderer", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -3192,8 +3303,21 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -3239,14 +3363,27 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -11912,8 +12049,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -11960,13 +12110,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12024,6 +12174,17 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -12054,8 +12215,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12102,13 +12276,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12143,8 +12317,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12191,13 +12378,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12242,8 +12429,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12290,13 +12490,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12354,6 +12554,17 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -12384,8 +12595,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12432,13 +12656,13 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "port": 7041, }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12548,6 +12772,17 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -12608,6 +12843,17 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, + { + "address": "orderer1.group1.orderer.example.com", + "adminPort": 7053, + "consensus": "etcdraft", + "domain": "orderer.example.com", + "fullAddress": "orderer1.group1.orderer.example.com:7031", + "name": "orderer1.group1", + "orgMspName": "some-org1", + "orgName": "some-org1", + "port": 7031, + }, ], "profileName": "Group1Genesis", }, @@ -12631,8 +12877,21 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "bootstrapPeers": "peer0.org1.example.com:7041", + "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12678,14 +12937,27 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], - "peersCount": 1, + "peersCount": 2, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap index eb6798424..dff8d3a0a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap @@ -1587,6 +1587,8 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) + # todo start ccaas containers if needed + # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1604,7 +1606,7 @@ installChannels() { installChaincodes() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node")" ]; then printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" else @@ -1633,7 +1635,7 @@ installChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1654,7 +1656,7 @@ runDevModeChaincode() { if [ "$chaincodeName" = "chaincode1" ]; then local version="0.0.1" printHeadline "Approving 'chaincode1' for Org1 (dev mode)" "U1F60E" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1' (dev mode)" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "0.0.1" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1680,7 +1682,7 @@ upgradeChaincode() { chaincodeBuild "chaincode1" "node" "$CHAINCODES_BASE_DIR/./chaincodes/chaincode-kv-node" "16" chaincodePackage "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "node" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "" - chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" + chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "" "node" "" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "" "peer0.org1.example.com:7041" "" "" @@ -1711,24 +1713,25 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" + # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } networkDown() { - printHeadline "Destroying network" "U1F916" - (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) - printf "Removing chaincode containers & images... \\U1F5D1 \\n" - for container in $(docker ps -a | grep "dev-peer0.org1.example.com-chaincode1" | awk '{print $1}'); do + for container in $(docker ps -a | grep "peer0.org1.example.com-chaincode1" | awk '{print $1}'); do echo "Removing container $container..." docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" done - for image in $(docker images "dev-peer0.org1.example.com-chaincode1*" -q); do + for image in $(docker images "peer0.org1.example.com-chaincode1*" -q); do echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + printHeadline "Destroying network" "U1F916" + (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) + printf "Removing generated configs... \\U1F5D1 \\n" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/config" rm -rf "$FABLO_NETWORK_ROOT/fabric-config/crypto-config" @@ -1936,6 +1939,8 @@ services: - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer0Password # enabled gateway - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0Org1"} working_dir: /etc/hyperledger/fabric/peer/ command: peer node start --peer-chaincodedev=true ports: @@ -2012,6 +2017,70 @@ certsGenerate() { done } +certsGenerateCCaaS() { + local CONFIG_PATH=$1 + local CONTAINER_NAME=$2 + local ORG_DOMAIN=$3 + local CHAINCODE_NAME=$4 + local PEER_ADDRESS=$5 + + local OUTPUT_PATH="\${CONFIG_PATH}ccaas/\${CONTAINER_NAME}/tls" + mkdir -p "$OUTPUT_PATH" + + local CA_CERT="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/tlsca.\${ORG_DOMAIN}-cert.pem" + local CA_KEY="\${CONFIG_PATH}peerOrganizations/\${ORG_DOMAIN}/tlsca/priv-key.pem" + + echo "Generating TLS certs for \${CONTAINER_NAME}..." + inputLog "CONFIG_PATH: $CONFIG_PATH" + inputLog "CONTAINER_NAME: $CONTAINER_NAME" + inputLog "ORG_DOMAIN: $ORG_DOMAIN" + inputLog "CHAINCODE_NAME: $CHAINCODE_NAME" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CA cert: $CA_CERT" + inputLog "CA key : $CA_KEY" + inputLog "OUTPUT_PATH: $OUTPUT_PATH" + + docker run --rm \\ + -v "$OUTPUT_PATH:/certs" \\ + -v "$CA_CERT:/ca/ca.crt:ro" \\ + -v "$CA_KEY:/ca/ca.key:ro" \\ + alpine:latest sh -c ' + apk add --no-cache openssl >/dev/null && + openssl genrsa -out /certs/client.key 2048 && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && + openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && + base64 /certs/client.crt > /certs/client_pem.crt && + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs + ' + + cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" + echo "TLS certs generated for \${CONTAINER_NAME} at \${OUTPUT_PATH}" +} + genesisBlockCreate() { local CONTAINER_NAME=genesisBlockCreate @@ -2282,7 +2351,6 @@ dockerPullIfMissing() { } node_version_check() { - local fabric_shim_version="$1" local nodejs_version @@ -2303,7 +2371,6 @@ node_version_check() { fi echo $nodejs_version - } chaincodeBuild() { @@ -2348,7 +2415,6 @@ chaincodeBuild() { # Default to using npm for installation and build (cd "$CHAINCODE_DIR_PATH" && npm install && npm run build) - fi } @@ -2376,6 +2442,70 @@ chaincodePackage() { docker exec "$CLI_NAME" chown "$(id -u):$(id -g)" "/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" } +chaincodePackageCCaaS() { + local CLI_NAME=$1 + local PEER_ADDRESS=$2 + local CHAINCODE_NAME=$3 + local CHAINCODE_VERSION=$4 + local CHAINCODE_LABEL="\${CHAINCODE_NAME}_$CHAINCODE_VERSION" + local CHAINCODE_IMAGE=$5 + local CONTAINER_PORT=$6 + local CONTAINER_NAME=$7 + local TLS_ENABLED=$8 + + echo "Packaging CCaaS chaincode $CHAINCODE_NAME..." + inputLog "CHAINCODE_VERSION: $CHAINCODE_VERSION" + inputLog "PEER_ADDRESS: $PEER_ADDRESS" + inputLog "CLI_NAME: $CLI_NAME" + inputLog "CHAINCODE_IMAGE: $CHAINCODE_IMAGE" + inputLog "CONTAINER_PORT: $CONTAINER_PORT" + inputLog "TLS_ENABLED: $TLS_ENABLED" + + # Use the same container name logic as startCCaaSContainer + local ACTUAL_CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + local PACKAGE_DIR="./chaincode-packages/ccaas_$ACTUAL_CONTAINER_NAME" + + mkdir -p "$PACKAGE_DIR" + echo "{\\"type\\":\\"ccaas\\",\\"label\\":\\"$CHAINCODE_LABEL\\"}" >"$PACKAGE_DIR/metadata.json" + + mkdir -p "$PACKAGE_DIR/code" + + if [ "$TLS_ENABLED" = true ]; then + # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates + local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" + local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') + local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"domain\\": \\"\${ACTUAL_CONTAINER_NAME}\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED, + \\"client_auth_required\\": true, + \\"client_cert\\": \\"$SERVER_CERT\\", + \\"client_key\\": \\"$SERVER_KEY\\", + \\"root_cert\\": \\"$ROOT_CERT\\" + }" >"$PACKAGE_DIR/code/connection.json" + else + echo "{ + \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", + \\"dial_timeout\\": \\"10s\\", + \\"tls_required\\": $TLS_ENABLED + }" >"$PACKAGE_DIR/code/connection.json" + fi + + tar -czf "$PACKAGE_DIR/code.tar.gz" -C "$PACKAGE_DIR/code" connection.json + tar -czf "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" -C "$PACKAGE_DIR" metadata.json code.tar.gz + + docker cp "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" "$CLI_NAME:/var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" + + rm "./chaincode-packages/$CHAINCODE_LABEL.tar.gz" + rm -rf "$PACKAGE_DIR" + + echo "CCaaS package created at /var/hyperledger/cli/chaincode-packages/$CHAINCODE_LABEL.tar.gz" +} + chaincodeInstall() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2399,6 +2529,82 @@ chaincodeInstall() { "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" } +startCCaaSContainer() { + local PEER_ADDRESS="$1" + local CHAINCODE_NAME="$2" + local CHAINCODE_LABEL="$3" + local CHAINCODE_IMAGE="$4" + local EXTERNAL_PORT="$5" + local CLI_NAME="$6" + local CA_CERT="$7" + + local CONTAINER_NAME="ccaas-\${PEER_ADDRESS%%:*}-\${CHAINCODE_NAME}" + + # Query installed chaincodes to get the package ID + local CA_CERT_PARAMS=() + if [ -n "$CA_CERT" ]; then + CA_CERT_PARAMS=(--tls --cafile "/var/hyperledger/cli/$CA_CERT") + fi + + local QUERYINSTALLED_RESPONSE + local PACKAGE_ID + + QUERYINSTALLED_RESPONSE="$( + docker exec -e CORE_PEER_ADDRESS="$PEER_ADDRESS" "$CLI_NAME" peer lifecycle chaincode queryinstalled \\ + --output json \\ + "\${CA_CERT_PARAMS[@]+"\${CA_CERT_PARAMS[@]}"}" + )" + PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" + + if [ -z "$PACKAGE_ID" ]; then + echo "ERROR: Package ID not found for chaincode $CHAINCODE_LABEL" + echo "QUERYINSTALLED_RESPONSE: $QUERYINSTALLED_RESPONSE" + exit 1 + fi + + echo "PACKAGE_ID: $PACKAGE_ID" + + local PACKAGE_HASH="\${PACKAGE_ID#*:}" + + echo "Starting CCaaS container: $CONTAINER_NAME with ID: \${CHAINCODE_LABEL}:\${PACKAGE_HASH}" + + # Extract peer name and organization domain from peer address + local PEER_NAME="\${PEER_ADDRESS%%:*}" + + local ORG_DOMAIN=$(echo "$PEER_NAME" | sed 's/^[^.]*\\.//') + local CONFIG_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/" + local PORT_MAP="\${EXTERNAL_PORT}:7052" + + local NETWORK=$(docker inspect "\${PEER_ADDRESS%%:*}" | jq -r '.[0].NetworkSettings.Networks | keys[]') + + # Generate CCAAS-specific certificates with correct CN + echo "Generating CCAAS certificates for $CONTAINER_NAME..." + certsGenerateCCaaS "$CONFIG_PATH" "$CONTAINER_NAME" "$ORG_DOMAIN" "$CHAINCODE_NAME" "$PEER_ADDRESS" + + # Use generated CCAAS certificates + local CCAAS_TLS_PATH="$CONFIG_PATH/ccaas/$CONTAINER_NAME/tls" + + docker run -d \\ + --name "$CONTAINER_NAME" \\ + -e CORE_CHAINCODE_ADDRESS="0.0.0.0:7052" \\ + -e CHAINCODE_SERVER_ADDRESS=0.0.0.0:7052 \\ + -e CORE_CHAINCODE_ID_NAME="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CHAINCODE_ID="\${CHAINCODE_LABEL}:\${PACKAGE_HASH}" \\ + -e CORE_CHAINCODE_LOGGING_LEVEL=info \\ + -e CORE_CHAINCODE_LOGGING_SHIM=info \\ + -e CORE_PEER_TLS_ENABLED=true \\ + -e CORE_CHAINCODE_TLS_CERT_FILE=/etc/hyperledger/fabric/client.crt \\ + -e CORE_CHAINCODE_TLS_KEY_FILE=/etc/hyperledger/fabric/client.key \\ + -e CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer.crt \\ + -e CORE_PEER_LOCALMSPID=Org1MSP \\ + -v "$CCAAS_TLS_PATH/client.key:/etc/hyperledger/fabric/client.key" \\ + -v "$CCAAS_TLS_PATH/client.crt:/etc/hyperledger/fabric/client.crt" \\ + -v "$CCAAS_TLS_PATH/peer.crt:/etc/hyperledger/fabric/peer.crt" \\ + -p "$PORT_MAP" \\ + --network "$NETWORK" \\ + "$CHAINCODE_IMAGE" +} + chaincodeApprove() { local CLI_NAME=$1 local PEER_ADDRESS=$2 @@ -2454,6 +2660,7 @@ chaincodeApprove() { )" CC_PACKAGE_ID="$(jq ".installed_chaincodes | [.[]? | select(.label==\\"$CHAINCODE_LABEL\\") ][0].package_id // \\"\\"" -r <<<"$QUERYINSTALLED_RESPONSE")" if [ -z "$CC_PACKAGE_ID" ]; then + echo "CC_PACKAGE_ID not found, using default: $CHAINCODE_NAME:$CHAINCODE_VERSION" CC_PACKAGE_ID="$CHAINCODE_NAME:$CHAINCODE_VERSION" fi inputLog "CC_PACKAGE_ID: $CC_PACKAGE_ID" diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index b40924c24..727a18e45 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -83,6 +83,9 @@ Organizations: - Host: peer0.org1.example.com Port: 7041 + - Host: peer1.org1.example.com + Port: 7042 + ################################################################################ # SECTION: Application ################################################################################ @@ -114,6 +117,7 @@ Orderer: &Group1Defaults OrdererType: etcdraft Addresses: - orderer0.group1.orderer.example.com:7030 + - orderer1.group1.orderer.example.com:7031 EtcdRaft: Consenters: - Host: orderer0.group1.orderer.example.com @@ -121,6 +125,11 @@ Orderer: &Group1Defaults ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt + - Host: orderer1.group1.orderer.example.com + Port: 7031 + ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt + BatchTimeout: 2s BatchSize: MaxMessageCount: 1 @@ -202,7 +211,8 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "Orderer": { "mspid": "OrdererMSP", "peers": [ - "peer0.org1.example.com" + "peer0.org1.example.com", + "peer1.org1.example.com" ], "certificateAuthorities": [ "ca.orderer.example.com" @@ -218,6 +228,15 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "grpcOptions": { "ssl-target-name-override": "peer0.org1.example.com" } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } } }, "certificateAuthorities": { @@ -247,6 +266,7 @@ organizations: mspid: OrdererMSP peers: - peer0.org1.example.com + - peer1.org1.example.com certificateAuthorities: - ca.orderer.example.com peers: @@ -257,6 +277,13 @@ peers: /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt grpcOptions: ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com certificateAuthorities: ca.orderer.example.com: url: https://localhost:7020 @@ -281,7 +308,8 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "Org1": { "mspid": "Org1MSP", "peers": [ - "peer0.org1.example.com" + "peer0.org1.example.com", + "peer1.org1.example.com" ], "certificateAuthorities": [ "ca.org1.example.com" @@ -297,6 +325,15 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "grpcOptions": { "ssl-target-name-override": "peer0.org1.example.com" } + }, + "peer1.org1.example.com": { + "url": "grpcs://localhost:7042", + "tlsCACerts": { + "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" + }, + "grpcOptions": { + "ssl-target-name-override": "peer1.org1.example.com" + } } }, "certificateAuthorities": { @@ -326,6 +363,7 @@ organizations: mspid: Org1MSP peers: - peer0.org1.example.com + - peer1.org1.example.com certificateAuthorities: - ca.org1.example.com peers: @@ -336,6 +374,13 @@ peers: /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt grpcOptions: ssl-target-name-override: peer0.org1.example.com + peer1.org1.example.com: + url: grpcs://localhost:7042 + tlsCACerts: + path: >- + /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + grpcOptions: + ssl-target-name-override: peer1.org1.example.com certificateAuthorities: ca.org1.example.com: url: https://localhost:7040 @@ -354,6 +399,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre Domain: orderer.example.com Specs: - Hostname: orderer0.group1 + - Hostname: orderer1.group1 Template: Count: 0 Users: @@ -367,7 +413,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre Domain: org1.example.com Specs: Template: - Count: 1 + Count: 2 Users: Count: 1 " @@ -428,7 +474,8 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" }, "peers": [ - "peer0.org1.example.com" + "peer0.org1.example.com", + "peer1.org1.example.com" ], "signedCert": { "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" @@ -441,6 +488,12 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "tlsCACerts": { "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" } + }, + "peer1.org1.example.com": { + "url": "grpcs://peer1.org1.example.com:7042", + "tlsCACerts": { + "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" + } } }, "channels": { @@ -1572,6 +1625,12 @@ chaincodeList() { peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + elif + [ "$1" = "peer1.org1.example.com" ] + then + + peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name + else echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" @@ -1597,12 +1656,17 @@ chaincodeInvoke() { if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" fi + if [[ "$1" == "peer1.org1.example.com"* ]]; then + cli="cli.org1.example.com" + fi peer_addresses="$1" peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" + peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" peer_certs="$1" peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" + peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" @@ -1627,6 +1691,12 @@ channelQuery() { peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + elif + [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] + then + + peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + elif [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] @@ -1662,6 +1732,10 @@ printChannelsHelp() { echo -e "\\t List channels on 'peer0' of 'Org1'". echo "" + echo "fablo channel list org1 peer1" + echo -e "\\t List channels on 'peer1' of 'Org1'". + echo "" + echo "fablo channel getinfo my-channel1 org1 peer0" echo -e "\\t Get channel info on 'peer0' of 'Org1'". echo "" @@ -1914,6 +1988,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: @@ -1955,6 +2030,42 @@ services: networks: - basic + orderer1.group1.orderer.example.com: + container_name: orderer1.group1.orderer.example.com + image: hyperledger/fabric-orderer:\${FABRIC_VERSION} + environment: + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 + - ORDERER_GENERAL_LISTENPORT=7031 + - ORDERER_GENERAL_LOCALMSPID=OrdererMSP + - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp + # TLS Configuration + - ORDERER_GENERAL_TLS_ENABLED=true + - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Cluster TLS Configuration + - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt + - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key + - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] + # Genesis file configuration (for solo and raft) + - ORDERER_GENERAL_GENESISMETHOD=file + - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block + # Metrics configuration + - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 + - ORDERER_METRICS_PROVIDER=prometheus + working_dir: /var/hyperledger/orderer + command: orderer + ports: + - 7031:7031 + - 8031:9440 + volumes: + - ../fabric-config/config/:/var/hyperledger/config + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp + - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls + networks: + - basic + ca.org1.example.com: container_name: ca.org1.example.com image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} @@ -2027,6 +2138,7 @@ services: - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: @@ -2041,9 +2153,9 @@ services: - FABRIC_CA_URL=https://ca.org1.example.com:7054 - FABRIC_CA_NAME=ca.org1.example.com - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042 - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt - HFC_LOGGING={"error":"console","warn":"console","info":"console"} volumes: # note: fablo needs access to all anchor peer certs @@ -2063,7 +2175,7 @@ services: - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} @@ -2127,6 +2239,80 @@ services: - 5100:5984 networks: - basic + peer1.org1.example.com: + container_name: peer1.org1.example.com + image: hyperledger/fabric-peer:\${FABRIC_VERSION} + environment: + - CORE_PEER_LOCALMSPID=Org1MSP + - CORE_PEER_ID=peer1.org1.example.com + - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 + - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 + - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp + - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} + - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} + - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} + - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} + # + - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} + - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} + - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} + # metrics + - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 + - CORE_METRICS_PROVIDER=prometheus + # + - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic + - CORE_VM_DOCKER_ATTACHSTDOUT=true + - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock + - GODEBUG=netdns=go + # enabled TLS + - CORE_PEER_TLS_ENABLED=true + - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt + - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key + - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt + # CouchDB + - CORE_LEDGER_STATE_STATEDATABASE=CouchDB + - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer1.org1.example.com:5984 + - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer1 + - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer1Password + # enabled gateway + - CORE_PEER_GATEWAY_ENABLED=true + # ccaas builder configuration + - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} + working_dir: /etc/hyperledger/fabric/peer/ + command: peer node start + ports: + - 8042:9440 + - 7042:7042 + depends_on: + couchdb.peer1.org1.example.com: + condition: service_healthy + volumes: + - /var/run/docker.sock:/host/var/run/docker.sock + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls + - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users + - ../fabric-config/config:/etc/hyperledger/fabric/config + networks: + - basic + couchdb.peer1.org1.example.com: + container_name: couchdb.peer1.org1.example.com + image: couchdb:\${COUCHDB_VERSION} + environment: + - COUCHDB_USER=peer1 + - COUCHDB_PASSWORD=peer1Password + healthcheck: + test: "curl -f http://localhost:5984/" + interval: 5s + timeout: 10s + retries: 7 + ports: + - 5101:5984 + networks: + - basic db.explorer.example.com: image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} @@ -3377,7 +3563,9 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre __getOrdererAndPeerNodes() { echo " orderer0.group1.orderer.example.com + orderer1.group1.orderer.example.com peer0.org1.example.com + peer1.org1.example.com " } @@ -3500,6 +3688,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre subgraph Org_Org1 [Org: Org1] CA_ca_Org1[CA: ca_Org1 - postgres] Org1_peer0[Peer: peer0] + Org1_peer1[Peer: peer1] end subgraph Channel_my_channel1 [Channel: my-channel1] @@ -3510,6 +3699,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre Org_Orderer --> Channel_my_channel1 Org_Org1 -.-> Channel_my_channel1 Org1_peer0 --> Channel_my_channel1 + Org1_peer1 --> Channel_my_channel1 " `; diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index c07880f57..7cf3a9396 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -17,7 +17,7 @@ { "groupName": "group1", "type": "raft", - "instances": 1 + "instances": 2 } ] }, @@ -30,7 +30,7 @@ "db": "postgres" }, "peer": { - "instances": 1, + "instances": 2, "db": "CouchDb" }, "tools": { From a09b426c816a728919c1e02502fbf2ffc1303030 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 21 Aug 2025 08:09:55 -0500 Subject: [PATCH 463/471] fix-increase instances for fault tolerance warning Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-04-v2-snapshot.sh | 1 + e2e/__snapshots__/extendConfig.test.ts.snap | 142 ++++++++++++++++++ ...1chaincode-raft-explorer.json.test.ts.snap | 46 ++++++ ...ig-hlf2-1org-1chaincode-raft-explorer.json | 3 +- 4 files changed, 191 insertions(+), 1 deletion(-) diff --git a/e2e-network/docker/test-04-v2-snapshot.sh b/e2e-network/docker/test-04-v2-snapshot.sh index 2d370f245..3d8958d5a 100755 --- a/e2e-network/docker/test-04-v2-snapshot.sh +++ b/e2e-network/docker/test-04-v2-snapshot.sh @@ -116,6 +116,7 @@ hook_command="perl -i -pe 's/FABRIC_VERSION=2\.3\.3/FABRIC_VERSION=2\.4\.2/g' ./ waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" sleep 5 diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 1dd707851..2537b059f 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -2535,6 +2535,19 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -2701,6 +2714,19 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -2803,6 +2829,19 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -2832,6 +2871,12 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "peerAddress": "peer0.org1.example.com", "port": 17041, }, + { + "containerName": "ccaas-peer1.org1.example.com-chaincode1", + "orgDomain": "org1.example.com", + "peerAddress": "peer1.org1.example.com", + "port": 17042, + }, ], "privateData": [], "privateDataConfigFile": undefined, @@ -2915,6 +2960,19 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -3081,6 +3139,19 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -12109,6 +12180,19 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -12275,6 +12359,19 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -12377,6 +12474,19 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -12406,6 +12516,12 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "peerAddress": "peer0.org1.example.com", "port": 17041, }, + { + "containerName": "ccaas-peer1.org1.example.com-chaincode1", + "orgDomain": "org1.example.com", + "peerAddress": "peer1.org1.example.com", + "port": 17042, + }, ], "privateData": [], "privateDataConfigFile": undefined, @@ -12489,6 +12605,19 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { @@ -12655,6 +12784,19 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, + { + "address": "peer1.org1.example.com", + "couchDbExposePort": 5101, + "db": { + "image": "couchdb:\${COUCHDB_VERSION}", + "type": "CouchDb", + }, + "fullAddress": "peer1.org1.example.com:7042", + "gatewayEnabled": true, + "isAnchorPeer": true, + "name": "peer1", + "port": 7042, + }, ], "peersCount": 2, "tools": { diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 727a18e45..58b198628 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1715,6 +1715,23 @@ channelQuery() { peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + elif + [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] + then + + peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + TARGET_FILE=\${6:-"$channel-config.json"} + + peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + + elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then + BLOCK_NAME=$2 + TARGET_FILE=\${6:-"$BLOCK_NAME.block"} + + peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" + else echo "$@" @@ -1746,6 +1763,16 @@ printChannelsHelp() { echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". echo "" + echo "fablo channel getinfo my-channel1 org1 peer1" + echo -e "\\t Get channel info on 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" + echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + echo "fablo channel fetch my-channel1 org1 peer1 [file name]" + echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". + echo "" + } " `; @@ -1787,6 +1814,8 @@ installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" + printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" + docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" } installChaincodes() { @@ -1794,9 +1823,12 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + chaincodePackageCCaaS "cli.org1.example.com" "peer1.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "ccaas-peer1.org1.example.com-chaincode1" "true" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + startCCaaSContainer "peer1.org1.example.com:7042" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1824,9 +1856,12 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + chaincodePackageCCaaS "cli.org1.example.com" "peer1.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "ccaas-peer1.org1.example.com-chaincode1" "true" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + startCCaaSContainer "peer1.org1.example.com:7042" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1872,9 +1907,12 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" + chaincodePackageCCaaS "cli.org1.example.com" "peer1.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "ccaas-peer1.org1.example.com-chaincode1" "true" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" + startCCaaSContainer "peer1.org1.example.com:7042" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1920,6 +1958,14 @@ networkDown() { echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done + for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do + echo "Removing container $container..." + docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" + done + for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do + echo "Removing image $image..." + docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" + done printHeadline "Destroying network" "U1F916" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 7cf3a9396..12f708785 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -45,7 +45,8 @@ { "name": "Org1", "peers": [ - "peer0" + "peer0", + "peer1" ] } ] From 087684f1589430497df1a2123f791fd1f6088bef Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 21 Aug 2025 08:19:14 -0500 Subject: [PATCH 464/471] fix-expected validation count Signed-off-by: Pereowei Daniel --- e2e/fabloCommands.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 1a4a1d840..4f5aeeabc 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -96,7 +96,7 @@ describe("validate", () => { // Then expect(commandResult).toEqual(TestCommands.success()); expect(commandResult.output).toContain("Validation errors count: 0"); - expect(commandResult.output).toContain("Validation warnings count: 2"); + expect(commandResult.output).toContain("Validation warnings count: 0"); expect(commands.getFiles()).toEqual([]); }); From 58ce3e4bf96d6e19b5d0a5f74b123a0b24e85309 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 21 Aug 2025 09:12:02 -0500 Subject: [PATCH 465/471] fix-shellcheck validation Signed-off-by: Pereowei Daniel --- ...fig-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap | 6 +++--- ...fig-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap | 6 +++--- .../fablo-config-hlf2-1org-1chaincode.json.test.ts.snap | 6 +++--- ...ig-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap | 6 +++--- ...blo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 6 +++--- ...ig-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap | 6 +++--- .../fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap | 6 +++--- ...fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap | 6 +++--- .../fabric-docker/scripts/chaincode-functions-v2.sh | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap index dff8d3a0a..6992e515d 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap @@ -2473,9 +2473,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 58b198628..55d0e4821 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -2902,9 +2902,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index ef75fd6ae..5ca3bf610 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -2536,9 +2536,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index 5ebb8feee..e5207af6a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -3464,9 +3464,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 7cb0a10be..90cc7ed9a 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -4867,9 +4867,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index a8770b215..2d6db58c6 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -5379,9 +5379,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index 4f82f5e54..b3c5d6a1a 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -2760,9 +2760,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index 3cd4231fe..fa937d3de 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -2784,9 +2784,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \\"address\\": \\"\${ACTUAL_CONTAINER_NAME}:7052\\", diff --git a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh index 86082ec5f..c1d62ea00 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/chaincode-functions-v2.sh @@ -132,9 +132,9 @@ chaincodePackageCCaaS() { if [ "$TLS_ENABLED" = true ]; then # Use peer0.org1.example.com TLS certificates instead of CCaaS certificates local PEER_TLS_PATH="$FABLO_NETWORK_ROOT/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls" - local ROOT_CERT=$(cat "$PEER_TLS_PATH/ca.crt" | awk '{printf "%s\\n", $0}') - local SERVER_CERT=$(cat "$PEER_TLS_PATH/server.crt" | awk '{printf "%s\\n", $0}') - local SERVER_KEY=$(cat "$PEER_TLS_PATH/server.key" | awk '{printf "%s\\n", $0}') + local ROOT_CERT=$(awk '{printf "%s\\n", $0}' "$PEER_TLS_PATH/ca.crt") + local SERVER_CERT=$(awk '{printf "%s\\n", $0}' "$PEER_TLS_PATH/server.crt") + local SERVER_KEY=$(awk '{printf "%s\\n", $0}' "$PEER_TLS_PATH/server.key") echo "{ \"address\": \"${ACTUAL_CONTAINER_NAME}:7052\", From 61335917a211371594bac55044bd612a79b5a86e Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 21 Aug 2025 09:32:35 -0500 Subject: [PATCH 466/471] fix-wait for container Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-04-v2-snapshot.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-network/docker/test-04-v2-snapshot.sh b/e2e-network/docker/test-04-v2-snapshot.sh index 3d8958d5a..9837f90b4 100755 --- a/e2e-network/docker/test-04-v2-snapshot.sh +++ b/e2e-network/docker/test-04-v2-snapshot.sh @@ -57,6 +57,7 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" +waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" snapshot_name="fablo-snapshot-$(date -u +"%Y%m%d%H%M%S")" From 502116ae294f245ecc4efabe6a04589121d99008 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Thu, 21 Aug 2025 10:02:39 -0500 Subject: [PATCH 467/471] fix-endorsement Signed-off-by: Pereowei Daniel --- e2e-network/docker/test-04-v2-snapshot.sh | 2 - e2e/__snapshots__/extendConfig.test.ts.snap | 508 ++---------------- ...1chaincode-raft-explorer.json.test.ts.snap | 250 +-------- e2e/fabloCommands.test.ts | 2 +- ...ig-hlf2-1org-1chaincode-raft-explorer.json | 7 +- 5 files changed, 59 insertions(+), 710 deletions(-) diff --git a/e2e-network/docker/test-04-v2-snapshot.sh b/e2e-network/docker/test-04-v2-snapshot.sh index 9837f90b4..2d370f245 100755 --- a/e2e-network/docker/test-04-v2-snapshot.sh +++ b/e2e-network/docker/test-04-v2-snapshot.sh @@ -57,7 +57,6 @@ waitForContainer "couchdb.peer0.org1.example.com" "Apache CouchDB has started. T waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "db.explorer.example.com" "database system is ready to accept connections" "200" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" fablo_rest_org1="localhost:8801" snapshot_name="fablo-snapshot-$(date -u +"%Y%m%d%H%M%S")" @@ -117,7 +116,6 @@ hook_command="perl -i -pe 's/FABRIC_VERSION=2\.3\.3/FABRIC_VERSION=2\.4\.2/g' ./ waitForContainer "explorer.example.com" "Successfully created channel event hub for \[my-channel1\]" "200" waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" sleep 5 diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 2537b059f..bd27b2a90 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -2475,21 +2475,8 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2535,27 +2522,14 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2613,17 +2587,6 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "OrdererMSP", - "orgName": "Orderer", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -2654,21 +2617,8 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2714,27 +2664,14 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2769,21 +2706,8 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2829,27 +2753,14 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -2871,12 +2782,6 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "peerAddress": "peer0.org1.example.com", "port": 17041, }, - { - "containerName": "ccaas-peer1.org1.example.com-chaincode1", - "orgDomain": "org1.example.com", - "peerAddress": "peer1.org1.example.com", - "port": 17042, - }, ], "privateData": [], "privateDataConfigFile": undefined, @@ -2900,21 +2805,8 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -2960,27 +2852,14 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -3038,17 +2917,6 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "OrdererMSP", - "orgName": "Orderer", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -3079,21 +2947,8 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -3139,27 +2994,14 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -3269,17 +3111,6 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "OrdererMSP", - "orgName": "Orderer", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -3340,17 +3171,6 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "orgName": "Orderer", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "OrdererMSP", - "orgName": "Orderer", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -3374,21 +3194,8 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -3434,27 +3241,14 @@ exports[`extend config samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.j "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12120,21 +11914,8 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12180,27 +11961,14 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12258,17 +12026,6 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "some-org1", - "orgName": "some-org1", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -12299,21 +12056,8 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12359,27 +12103,14 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12414,21 +12145,8 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12474,27 +12192,14 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12516,12 +12221,6 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "peerAddress": "peer0.org1.example.com", "port": 17041, }, - { - "containerName": "ccaas-peer1.org1.example.com-chaincode1", - "orgDomain": "org1.example.com", - "peerAddress": "peer1.org1.example.com", - "port": 17042, - }, ], "privateData": [], "privateDataConfigFile": undefined, @@ -12545,21 +12244,8 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12605,27 +12291,14 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12683,17 +12356,6 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "some-org1", - "orgName": "some-org1", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -12724,21 +12386,8 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -12784,27 +12433,14 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { @@ -12914,17 +12550,6 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "some-org1", - "orgName": "some-org1", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -12985,17 +12610,6 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "orgName": "some-org1", "port": 7030, }, - { - "address": "orderer1.group1.orderer.example.com", - "adminPort": 7053, - "consensus": "etcdraft", - "domain": "orderer.example.com", - "fullAddress": "orderer1.group1.orderer.example.com:7031", - "name": "orderer1.group1", - "orgMspName": "some-org1", - "orgName": "some-org1", - "port": 7031, - }, ], "profileName": "Group1Genesis", }, @@ -13019,21 +12633,8 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "bootstrapPeers": ""peer0.org1.example.com:7041 peer1.org1.example.com:7042"", + "bootstrapPeers": "peer0.org1.example.com:7041", "ca": { "address": "ca.org1.example.com", "caAdminNameVar": "ORG1_CA_ADMIN_NAME", @@ -13079,27 +12680,14 @@ exports[`extend config samples/invalid-fablo-config.json 1`] = ` "name": "peer0", "port": 7041, }, - { - "address": "peer1.org1.example.com", - "couchDbExposePort": 5101, - "db": { - "image": "couchdb:\${COUCHDB_VERSION}", - "type": "CouchDb", - }, - "fullAddress": "peer1.org1.example.com:7042", - "gatewayEnabled": true, - "isAnchorPeer": true, - "name": "peer1", - "port": 7042, - }, ], - "peersCount": 2, + "peersCount": 1, "tools": { "fabloRest": { "address": "fablo-rest.org1.example.com", "discoverySslTargetNameOverrides": "", - "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt", - "discoveryUrls": "grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042", + "discoveryTlsCaCertFiles": "/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt", + "discoveryUrls": "grpcs://peer0.org1.example.com:7041", "fabricCaName": "ca.org1.example.com", "fabricCaUrl": "https://ca.org1.example.com:7054", "logging": { diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 55d0e4821..600599446 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -83,9 +83,6 @@ Organizations: - Host: peer0.org1.example.com Port: 7041 - - Host: peer1.org1.example.com - Port: 7042 - ################################################################################ # SECTION: Application ################################################################################ @@ -117,7 +114,6 @@ Orderer: &Group1Defaults OrdererType: etcdraft Addresses: - orderer0.group1.orderer.example.com:7030 - - orderer1.group1.orderer.example.com:7031 EtcdRaft: Consenters: - Host: orderer0.group1.orderer.example.com @@ -125,11 +121,6 @@ Orderer: &Group1Defaults ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/tls/server.crt - - Host: orderer1.group1.orderer.example.com - Port: 7031 - ClientTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt - ServerTLSCert: crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/server.crt - BatchTimeout: 2s BatchSize: MaxMessageCount: 1 @@ -211,8 +202,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "Orderer": { "mspid": "OrdererMSP", "peers": [ - "peer0.org1.example.com", - "peer1.org1.example.com" + "peer0.org1.example.com" ], "certificateAuthorities": [ "ca.orderer.example.com" @@ -228,15 +218,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "grpcOptions": { "ssl-target-name-override": "peer0.org1.example.com" } - }, - "peer1.org1.example.com": { - "url": "grpcs://localhost:7042", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer1.org1.example.com" - } } }, "certificateAuthorities": { @@ -266,7 +247,6 @@ organizations: mspid: OrdererMSP peers: - peer0.org1.example.com - - peer1.org1.example.com certificateAuthorities: - ca.orderer.example.com peers: @@ -277,13 +257,6 @@ peers: /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt grpcOptions: ssl-target-name-override: peer0.org1.example.com - peer1.org1.example.com: - url: grpcs://localhost:7042 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer1.org1.example.com certificateAuthorities: ca.orderer.example.com: url: https://localhost:7020 @@ -308,8 +281,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "Org1": { "mspid": "Org1MSP", "peers": [ - "peer0.org1.example.com", - "peer1.org1.example.com" + "peer0.org1.example.com" ], "certificateAuthorities": [ "ca.org1.example.com" @@ -325,15 +297,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "grpcOptions": { "ssl-target-name-override": "peer0.org1.example.com" } - }, - "peer1.org1.example.com": { - "url": "grpcs://localhost:7042", - "tlsCACerts": { - "path": "/samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt" - }, - "grpcOptions": { - "ssl-target-name-override": "peer1.org1.example.com" - } } }, "certificateAuthorities": { @@ -363,7 +326,6 @@ organizations: mspid: Org1MSP peers: - peer0.org1.example.com - - peer1.org1.example.com certificateAuthorities: - ca.org1.example.com peers: @@ -374,13 +336,6 @@ peers: /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt grpcOptions: ssl-target-name-override: peer0.org1.example.com - peer1.org1.example.com: - url: grpcs://localhost:7042 - tlsCACerts: - path: >- - /samples/fablo-target/fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt - grpcOptions: - ssl-target-name-override: peer1.org1.example.com certificateAuthorities: ca.org1.example.com: url: https://localhost:7040 @@ -399,7 +354,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre Domain: orderer.example.com Specs: - Hostname: orderer0.group1 - - Hostname: orderer1.group1 Template: Count: 0 Users: @@ -413,7 +367,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre Domain: org1.example.com Specs: Template: - Count: 2 + Count: 1 Users: Count: 1 " @@ -474,8 +428,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv-key.pem" }, "peers": [ - "peer0.org1.example.com", - "peer1.org1.example.com" + "peer0.org1.example.com" ], "signedCert": { "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem" @@ -488,12 +441,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre "tlsCACerts": { "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" } - }, - "peer1.org1.example.com": { - "url": "grpcs://peer1.org1.example.com:7042", - "tlsCACerts": { - "path": "/tmp/crypto/peerOrganizations/org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem" - } } }, "channels": { @@ -1625,12 +1572,6 @@ chaincodeList() { peerChaincodeListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - elif - [ "$1" = "peer1.org1.example.com" ] - then - - peerChaincodeListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "$2" "crypto-orderer/tlsca.orderer.example.com-cert.pem" # Third argument is channel name - else echo "Fail to call listChaincodes. No peer or channel found. Provided peer: $1, channel: $2" @@ -1656,17 +1597,12 @@ chaincodeInvoke() { if [[ "$1" == "peer0.org1.example.com"* ]]; then cli="cli.org1.example.com" fi - if [[ "$1" == "peer1.org1.example.com"* ]]; then - cli="cli.org1.example.com" - fi peer_addresses="$1" peer_addresses="\${peer_addresses//peer0.org1.example.com/peer0.org1.example.com:7041}" - peer_addresses="\${peer_addresses//peer1.org1.example.com/peer1.org1.example.com:7042}" peer_certs="$1" peer_certs="\${peer_certs//peer0.org1.example.com/crypto/peers/peer0.org1.example.com/tls/ca.crt}" - peer_certs="\${peer_certs//peer1.org1.example.com/crypto/peers/peer1.org1.example.com/tls/ca.crt}" if [ "$2" = "my-channel1" ]; then ca_cert="crypto-orderer/tlsca.orderer.example.com-cert.pem" @@ -1691,12 +1627,6 @@ channelQuery() { peerChannelListTls "cli.org1.example.com" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - elif - [ "$1" = "list" ] && [ "$2" = "org1" ] && [ "$3" = "peer1" ] - then - - peerChannelListTls "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - elif [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer0" ] @@ -1715,23 +1645,6 @@ channelQuery() { peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer0.org1.example.com:7041" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - elif - [ "$1" = "getinfo" ] && [ "$2" = "my-channel1" ] && [ "$3" = "org1" ] && [ "$4" = "peer1" ] - then - - peerChannelGetInfoTls "my-channel1" "cli.org1.example.com" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$2" = "config" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then - TARGET_FILE=\${6:-"$channel-config.json"} - - peerChannelFetchConfigTls "my-channel1" "cli.org1.example.com" "$TARGET_FILE" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - - elif [ "$1" = "fetch" ] && [ "$3" = "my-channel1" ] && [ "$4" = "org1" ] && [ "$5" = "peer1" ]; then - BLOCK_NAME=$2 - TARGET_FILE=\${6:-"$BLOCK_NAME.block"} - - peerChannelFetchBlockTls "my-channel1" "cli.org1.example.com" "\${BLOCK_NAME}" "peer1.org1.example.com:7042" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "$TARGET_FILE" - else echo "$@" @@ -1749,10 +1662,6 @@ printChannelsHelp() { echo -e "\\t List channels on 'peer0' of 'Org1'". echo "" - echo "fablo channel list org1 peer1" - echo -e "\\t List channels on 'peer1' of 'Org1'". - echo "" - echo "fablo channel getinfo my-channel1 org1 peer0" echo -e "\\t Get channel info on 'peer0' of 'Org1'". echo "" @@ -1763,16 +1672,6 @@ printChannelsHelp() { echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer0' of 'Org1'". echo "" - echo "fablo channel getinfo my-channel1 org1 peer1" - echo -e "\\t Get channel info on 'peer1' of 'Org1'". - echo "" - echo "fablo channel fetch config my-channel1 org1 peer1 [file-name.json]" - echo -e "\\t Download latest config block and save it. Uses first peer 'peer1' of 'Org1'". - echo "" - echo "fablo channel fetch my-channel1 org1 peer1 [file name]" - echo -e "\\t Fetch a block with given number and save it. Uses first peer 'peer1' of 'Org1'". - echo "" - } " `; @@ -1814,8 +1713,6 @@ installChannels() { printHeadline "Creating 'my-channel1' on Org1/peer0" "U1F63B" docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; createChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer0.org1.example.com:7041' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" - printItalics "Joining 'my-channel1' on Org1/peer1" "U1F638" - docker exec -i cli.org1.example.com bash -c "source scripts/channel_fns.sh; fetchChannelAndJoinTls 'my-channel1' 'Org1MSP' 'peer1.org1.example.com:7042' 'crypto/users/Admin@org1.example.com/msp' 'crypto/users/Admin@org1.example.com/tls' 'crypto-orderer/tlsca.orderer.example.com-cert.pem' 'orderer0.group1.orderer.example.com:7030';" } installChaincodes() { @@ -1823,12 +1720,9 @@ installChaincodes() { local version="0.0.1" printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" - chaincodePackageCCaaS "cli.org1.example.com" "peer1.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "ccaas-peer1.org1.example.com-chaincode1" "true" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - startCCaaSContainer "peer1.org1.example.com:7042" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1856,12 +1750,9 @@ installChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" - chaincodePackageCCaaS "cli.org1.example.com" "peer1.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "ccaas-peer1.org1.example.com-chaincode1" "true" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - startCCaaSContainer "peer1.org1.example.com:7042" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1907,12 +1798,9 @@ upgradeChaincode() { if [ -n "$(ls "$CHAINCODES_BASE_DIR/")" ]; then printHeadline "Packaging chaincode 'chaincode1'" "U1F60E" chaincodePackageCCaaS "cli.org1.example.com" "peer0.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "ccaas-peer0.org1.example.com-chaincode1" "true" - chaincodePackageCCaaS "cli.org1.example.com" "peer1.org1.example.com" "chaincode1" "$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "ccaas-peer1.org1.example.com-chaincode1" "true" printHeadline "Installing 'chaincode1' for Org1" "U1F60E" chaincodeInstall "cli.org1.example.com" "peer0.org1.example.com:7041" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" startCCaaSContainer "peer0.org1.example.com:7041" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17041" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - chaincodeInstall "cli.org1.example.com" "peer1.org1.example.com:7042" "chaincode1" "$version" "crypto-orderer/tlsca.orderer.example.com-cert.pem" - startCCaaSContainer "peer1.org1.example.com:7042" "chaincode1" "chaincode1_$version" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" "17042" "cli.org1.example.com" "crypto-orderer/tlsca.orderer.example.com-cert.pem" chaincodeApprove "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "" "ccaas" "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0" printItalics "Committing chaincode 'chaincode1' on channel 'my-channel1' as 'Org1'" "U1F618" chaincodeCommit "cli.org1.example.com" "peer0.org1.example.com:7041" "my-channel1" "chaincode1" "$version" "orderer0.group1.orderer.example.com:7030" "" "false" "crypto-orderer/tlsca.orderer.example.com-cert.pem" "peer0.org1.example.com:7041" "crypto-peer/peer0.org1.example.com/tls/ca.crt" "" @@ -1958,14 +1846,6 @@ networkDown() { echo "Removing image $image..." docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" done - for container in $(docker ps -a | grep "peer1.org1.example.com-chaincode1" | awk '{print $1}'); do - echo "Removing container $container..." - docker rm -f "$container" || echo "docker rm of $container failed. Check if all fabric dockers properly was deleted" - done - for image in $(docker images "peer1.org1.example.com-chaincode1*" -q); do - echo "Removing image $image..." - docker rmi "$image" || echo "docker rmi of $image failed. Check if all fabric dockers properly was deleted" - done printHeadline "Destroying network" "U1F916" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose down) @@ -2034,7 +1914,6 @@ services: - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com:/var/hyperledger/cli/crypto/ - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: @@ -2076,42 +1955,6 @@ services: networks: - basic - orderer1.group1.orderer.example.com: - container_name: orderer1.group1.orderer.example.com - image: hyperledger/fabric-orderer:\${FABRIC_VERSION} - environment: - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - - ORDERER_GENERAL_LISTENPORT=7031 - - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp - # TLS Configuration - - ORDERER_GENERAL_TLS_ENABLED=true - - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Cluster TLS Configuration - - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt - - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key - - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] - # Genesis file configuration (for solo and raft) - - ORDERER_GENERAL_GENESISMETHOD=file - - ORDERER_GENERAL_BOOTSTRAPFILE=/var/hyperledger/config/Group1Genesis.block - # Metrics configuration - - ORDERER_OPERATIONS_LISTENADDRESS=orderer1.group1.orderer.example.com:9443 - - ORDERER_METRICS_PROVIDER=prometheus - working_dir: /var/hyperledger/orderer - command: orderer - ports: - - 7031:7031 - - 8031:9440 - volumes: - - ../fabric-config/config/:/var/hyperledger/config - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/msp/:/var/hyperledger/orderer/msp - - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer1.group1.orderer.example.com/tls/:/var/hyperledger/orderer/tls - networks: - - basic - ca.org1.example.com: container_name: ca.org1.example.com image: hyperledger/fabric-ca:\${FABRIC_CA_VERSION} @@ -2184,7 +2027,6 @@ services: - ../fabric-config/crypto-config/peerOrganizations/org1.example.com:/var/hyperledger/cli/crypto/ - ../fabric-config/crypto-config/peerOrganizations/orderer.example.com/peers/orderer0.group1.orderer.example.com/msp/tlscacerts/tlsca.orderer.example.com-cert.pem:/var/hyperledger/cli/crypto-orderer/tlsca.orderer.example.com-cert.pem:ro - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer0.org1.example.com/tls/ca.crt:ro - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt:/var/hyperledger/cli/crypto-peer/peer1.org1.example.com/tls/ca.crt:ro - ../fabric-config/chaincode-packages:/var/hyperledger/cli/chaincode-packages/ - "$CHAINCODES_BASE_DIR//:/var/hyperledger/cli/chaincode1/" networks: @@ -2199,9 +2041,9 @@ services: - FABRIC_CA_URL=https://ca.org1.example.com:7054 - FABRIC_CA_NAME=ca.org1.example.com - AS_LOCALHOST=false - - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041,grpcs://peer1.org1.example.com:7042 + - DISCOVERY_URLS=grpcs://peer0.org1.example.com:7041 - DISCOVERY_SSL_TARGET_NAME_OVERRIDES= - - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt,/crypto/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt + - DISCOVERY_TLS_CA_CERT_FILES=/crypto/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt - HFC_LOGGING={"error":"console","warn":"console","info":"console"} volumes: # note: fablo needs access to all anchor peer certs @@ -2221,7 +2063,7 @@ services: - CORE_PEER_LISTENADDRESS=peer0.org1.example.com:7041 - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.example.com:7041 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7041 - - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" + - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7041 - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7050 - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} @@ -2285,80 +2127,6 @@ services: - 5100:5984 networks: - basic - peer1.org1.example.com: - container_name: peer1.org1.example.com - image: hyperledger/fabric-peer:\${FABRIC_VERSION} - environment: - - CORE_PEER_LOCALMSPID=Org1MSP - - CORE_PEER_ID=peer1.org1.example.com - - CORE_PEER_ADDRESS=peer1.org1.example.com:7042 - - CORE_PEER_LISTENADDRESS=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7042 - - CORE_PEER_GOSSIP_BOOTSTRAP="peer0.org1.example.com:7041 peer1.org1.example.com:7042" - - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7050 - - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/peer/msp - - CORE_CHAINCODE_BUILDER=hyperledger/fabric-ccenv:\${FABRIC_CCENV_VERSION} - - CORE_CHAINCODE_GOLANG_RUNTIME=hyperledger/fabric-baseos:\${FABRIC_BASEOS_VERSION} - - CORE_CHAINCODE_JAVA_RUNTIME=hyperledger/fabric-javaenv:\${FABRIC_JAVAENV_VERSION} - - CORE_CHAINCODE_NODE_RUNTIME=hyperledger/fabric-nodeenv:\${FABRIC_NODEENV_VERSION} - # - - CORE_CHAINCODE_LOGGING_LEVEL=\${LOGGING_LEVEL} - - CORE_CHAINCODE_LOGGING_SHIM=\${LOGGING_LEVEL} - - FABRIC_LOGGING_SPEC=\${LOGGING_LEVEL} - # metrics - - CORE_OPERATIONS_LISTENADDRESS=peer1.org1.example.com:9440 - - CORE_METRICS_PROVIDER=prometheus - # - - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=\${COMPOSE_PROJECT_NAME}_basic - - CORE_VM_DOCKER_ATTACHSTDOUT=true - - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - - GODEBUG=netdns=go - # enabled TLS - - CORE_PEER_TLS_ENABLED=true - - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/peer/tls/server.crt - - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/peer/tls/server.key - - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/peer/tls/ca.crt - # CouchDB - - CORE_LEDGER_STATE_STATEDATABASE=CouchDB - - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb.peer1.org1.example.com:5984 - - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=peer1 - - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=peer1Password - # enabled gateway - - CORE_PEER_GATEWAY_ENABLED=true - # ccaas builder configuration - - CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer1Org1"} - working_dir: /etc/hyperledger/fabric/peer/ - command: peer node start - ports: - - 8042:9440 - - 7042:7042 - depends_on: - couchdb.peer1.org1.example.com: - condition: service_healthy - volumes: - - /var/run/docker.sock:/host/var/run/docker.sock - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/peer/msp - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/peer/tls - - ../fabric-config/crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/fabric/peer/msp/users - - ../fabric-config/config:/etc/hyperledger/fabric/config - networks: - - basic - couchdb.peer1.org1.example.com: - container_name: couchdb.peer1.org1.example.com - image: couchdb:\${COUCHDB_VERSION} - environment: - - COUCHDB_USER=peer1 - - COUCHDB_PASSWORD=peer1Password - healthcheck: - test: "curl -f http://localhost:5984/" - interval: 5s - timeout: 10s - retries: 7 - ports: - - 5101:5984 - networks: - - basic db.explorer.example.com: image: ghcr.io/hyperledger-labs/explorer-db:\${HYPERLEDGER_EXPLORER_VERSION} @@ -3609,9 +3377,7 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre __getOrdererAndPeerNodes() { echo " orderer0.group1.orderer.example.com - orderer1.group1.orderer.example.com peer0.org1.example.com - peer1.org1.example.com " } @@ -3734,7 +3500,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre subgraph Org_Org1 [Org: Org1] CA_ca_Org1[CA: ca_Org1 - postgres] Org1_peer0[Peer: peer0] - Org1_peer1[Peer: peer1] end subgraph Channel_my_channel1 [Channel: my-channel1] @@ -3745,7 +3510,6 @@ exports[`samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json should cre Org_Orderer --> Channel_my_channel1 Org_Org1 -.-> Channel_my_channel1 Org1_peer0 --> Channel_my_channel1 - Org1_peer1 --> Channel_my_channel1 " `; diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index 4f5aeeabc..dcb9087d6 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -96,7 +96,7 @@ describe("validate", () => { // Then expect(commandResult).toEqual(TestCommands.success()); expect(commandResult.output).toContain("Validation errors count: 0"); - expect(commandResult.output).toContain("Validation warnings count: 0"); + expect(commandResult.output).toContain("Validation warnings count: 1"); expect(commands.getFiles()).toEqual([]); }); diff --git a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json index 12f708785..c07880f57 100644 --- a/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json +++ b/samples/fablo-config-hlf2-1org-1chaincode-raft-explorer.json @@ -17,7 +17,7 @@ { "groupName": "group1", "type": "raft", - "instances": 2 + "instances": 1 } ] }, @@ -30,7 +30,7 @@ "db": "postgres" }, "peer": { - "instances": 2, + "instances": 1, "db": "CouchDb" }, "tools": { @@ -45,8 +45,7 @@ { "name": "Org1", "peers": [ - "peer0", - "peer1" + "peer0" ] } ] From 1c275c99a6ca517acd12106e038690f5aea426ee Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 22 Aug 2025 05:44:17 -0500 Subject: [PATCH 468/471] fix-resolve review comments Signed-off-by: Pereowei Daniel --- CHANGELOG.md | 2 + e2e-network/docker/test-01-v2-simple.sh | 8 +- e2e-network/docker/test-05.sh | 93 ------------------- e2e/__snapshots__/extendConfig.test.ts.snap | 2 + ...1chaincode-peer-dev-mode.json.test.ts.snap | 3 - ...1chaincode-raft-explorer.json.test.ts.snap | 3 - ...fig-hlf2-1org-1chaincode.json.test.ts.snap | 3 - ...2chaincodes-private-data.yaml.test.ts.snap | 3 - ...2-2orgs-2chaincodes-raft.yaml.test.ts.snap | 3 - ...1chaincode-raft-explorer.json.test.ts.snap | 3 - ...ig-hlf3-1orgs-1chaincode.json.test.ts.snap | 32 +++++-- ...lf3-bft-1orgs-1chaincode.json.test.ts.snap | 32 +++++-- .../fabric-docker/commands-generated.sh | 3 - .../scripts/base-functions-v3.sh | 29 +++++- 14 files changed, 89 insertions(+), 130 deletions(-) delete mode 100644 e2e-network/docker/test-05.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 21f9a4218..372b49e30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ * Support installing Chaincode from Docker image using CCaaS [#550](https://github.com/hyperledger-labs/fablo/pull/550) [#582](https://github.com/hyperledger-labs/fablo/pull/582) +* Starting from this PR, `fablo init` command will generate network with TLS enabled and RAFT consensus instead of SOLO with TLS disabled + [#594](https://github.com/hyperledger-labs/fablo/pull/594) ## 2.2.0 diff --git a/e2e-network/docker/test-01-v2-simple.sh b/e2e-network/docker/test-01-v2-simple.sh index 2a0ea3093..e36c0c4df 100755 --- a/e2e-network/docker/test-01-v2-simple.sh +++ b/e2e-network/docker/test-01-v2-simple.sh @@ -91,4 +91,10 @@ expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ '{"Args":["KVContract:put", "name", "James Bond"]}' \ '{\"success\":\"OK\"}' -echo "✅ Test passed!" +# Test export-network-topology to Mermaid +cp -f "$FABLO_HOME/samples/fablo-config-hlf2-1org-1chaincode.json" "$TEST_TMP/simple-config.json" +(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" export-network-topology simple-config.json simple-network-topology.mmd) +expectCommand "head -n 1 \"$TEST_TMP/simple-network-topology.mmd\"" "graph TD" +expectCommand "cat \"$TEST_TMP/simple-network-topology.mmd\"" "Org_Orderer" +expectCommand "cat \"$TEST_TMP/simple-network-topology.mmd\"" "Org_Org1" +expectCommand "cat \"$TEST_TMP/simple-network-topology.mmd\"" "Channel_my_channel1" \ No newline at end of file diff --git a/e2e-network/docker/test-05.sh b/e2e-network/docker/test-05.sh deleted file mode 100644 index 808b6336f..000000000 --- a/e2e-network/docker/test-05.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -TEST_TMP="$(rm -rf "$0.tmpdir" && mkdir -p "$0.tmpdir" && (cd "$0.tmpdir" && pwd))" -TEST_LOGS="$(mkdir -p "$0.logs" && (cd "$0.logs" && pwd))" -FABLO_HOME="$TEST_TMP/../../.." - -CONFIG="$FABLO_HOME/samples/fablo-config-hlf3-1orgs-1chaincode.json" - -networkUp() { - "$FABLO_HOME/fablo-build.sh" - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" generate "$CONFIG") - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" up) -} - -dumpLogs() { - echo "Saving logs of $1 to $TEST_LOGS/$1.log" - mkdir -p "$TEST_LOGS" - docker logs "$1" >"$TEST_LOGS/$1.log" 2>&1 -} - -networkDown() { - rm -rf "$TEST_LOGS" - (for name in $(docker ps --format '{{.Names}}'); do dumpLogs "$name"; done) - dumpLogs orderer0.group1.orderer.example.com - (cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" down) -} - -waitForContainer() { - sh "$TEST_TMP/../wait-for-container.sh" "$1" "$2" -} - -waitForChaincode() { - (cd "$TEST_TMP" && sh ../wait-for-chaincode.sh "$1" "$2" "$3" "$4") -} - -expectInvoke() { - (cd "$TEST_TMP" && sh ../expect-invoke-cli.sh "$1" "$2" "$3" "$4" "$5" "$6") -} - -expectCommand() { - sh "$TEST_TMP/../expect-command.sh" "$1" "$2" -} - -trap networkDown EXIT -trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT - -# start the network -networkUp - -waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" -waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" -waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" -waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer0.org1.example.com" "Anchor peer.*with same endpoint, skipping connecting to myself" -waitForContainer "peer0.org1.example.com" "Membership view has changed. peers went online:.*peer1.org1.example.com:7042" -waitForContainer "peer1.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" -waitForContainer "peer1.org1.example.com" "Membership view has changed. peers went online:.*peer0.org1.example.com:7041" - -# Test simple chaincode -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "Willy Wonka"]}' \ - '{\"success\":\"OK\"}' -expectInvoke "peer1.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"success\":\"Willy Wonka\"}' - -# Verify channel query scripts -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch newest my-channel1 org1 peer1) -expectCommand "cat \"$TEST_TMP/newest.block\"" "KVContract:get" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch 4 my-channel1 org1 peer1 "another.block") -expectCommand "cat \"$TEST_TMP/another.block\"" "KVContract:put" - -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" channel fetch config my-channel1 org1 peer1 "channel-config.json") -expectCommand "cat \"$TEST_TMP/channel-config.json\"" "\"mod_policy\": \"Admins\"," - -expectCommand "(cd \"$TEST_TMP\" && \"$FABLO_HOME/fablo.sh\" channel getinfo my-channel1 org1 peer1)" "\"height\":6" - -# Reset and ensure the state is lost after reset -(cd "$TEST_TMP" && "$FABLO_HOME/fablo.sh" reset) -waitForChaincode "peer0.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -waitForChaincode "peer1.org1.example.com" "my-channel1" "chaincode1" "0.0.1" -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:get", "name"]}' \ - '{\"error\":\"NOT_FOUND\"}' - -# Put some data again -expectInvoke "peer0.org1.example.com" "my-channel1" "chaincode1" \ - '{"Args":["KVContract:put", "name", "James Bond"]}' \ - '{\"success\":\"OK\"}' \ No newline at end of file diff --git a/e2e/__snapshots__/extendConfig.test.ts.snap b/e2e/__snapshots__/extendConfig.test.ts.snap index 18afad826..e651bf26d 100644 --- a/e2e/__snapshots__/extendConfig.test.ts.snap +++ b/e2e/__snapshots__/extendConfig.test.ts.snap @@ -12900,6 +12900,7 @@ exports[`extend config samples/java-dev-mode-sample.json 1`] = ` }, "directory": "./chaincodes/java-chaincode", "endorsement": undefined, + "image": undefined, "initRequired": false, "instantiatingOrg": { "anchorPeers": [ @@ -12966,6 +12967,7 @@ exports[`extend config samples/java-dev-mode-sample.json 1`] = ` }, "lang": "java", "name": "chaincode1", + "peerChaincodeInstances": [], "privateData": [], "privateDataConfigFile": undefined, "version": "0.0.1", diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap index 6992e515d..1bad7b634 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-peer-dev-mode.json.test.ts.snap @@ -1587,8 +1587,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1713,7 +1711,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap index 600599446..efe5a6118 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap @@ -1699,8 +1699,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1831,7 +1829,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap index 5ca3bf610..82ea291d8 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap @@ -1651,8 +1651,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1785,7 +1783,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap index e5207af6a..eeac3d8d1 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap @@ -2365,8 +2365,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -2580,7 +2578,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap index 90cc7ed9a..45efd9f2b 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap @@ -3467,8 +3467,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3704,7 +3702,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap index 2d6db58c6..189f84ed3 100644 --- a/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap @@ -3801,8 +3801,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -3962,7 +3960,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap index b3c5d6a1a..25aff19fb 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap @@ -1731,8 +1731,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1851,7 +1849,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -2351,11 +2348,34 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" diff --git a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap index fa937d3de..dfa538374 100644 --- a/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap +++ b/e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap @@ -1756,8 +1756,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -1875,7 +1873,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } @@ -2375,11 +2372,34 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \\ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" diff --git a/src/setup-docker/templates/fabric-docker/commands-generated.sh b/src/setup-docker/templates/fabric-docker/commands-generated.sh index e3e207ebf..71ac171e2 100644 --- a/src/setup-docker/templates/fabric-docker/commands-generated.sh +++ b/src/setup-docker/templates/fabric-docker/commands-generated.sh @@ -28,8 +28,6 @@ generateArtifacts() { startNetwork() { printHeadline "Starting network" "U1F680" (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose up -d) - # todo start ccaas containers if needed - # todo remore ccaas start from chaincode scripts sleep 4 } @@ -243,7 +241,6 @@ printStartSuccessInfo() { stopNetwork() { printHeadline "Stopping network" "U1F68F" - # todo stop ccaas containers (cd "$FABLO_NETWORK_ROOT"/fabric-docker && docker compose stop) sleep 4 } diff --git a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh index 5585aecc7..41eecf447 100644 --- a/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh +++ b/src/setup-docker/templates/fabric-docker/scripts/base-functions-v3.sh @@ -68,11 +68,34 @@ certsGenerateCCaaS() { alpine:latest sh -c ' apk add --no-cache openssl >/dev/null && openssl genrsa -out /certs/client.key 2048 && - openssl req -new -key /certs/client.key -out /certs/client.csr -subj "/CN='"$CONTAINER_NAME"'" && + + # Create openssl config with SANs + cat > /certs/openssl.cnf << EOF +[req] +distinguished_name = req_distinguished_name +req_extensions = v3_req +prompt = no + +[req_distinguished_name] +CN = '"$CONTAINER_NAME"' + +[v3_req] +basicConstraints = CA:FALSE +keyUsage = nonRepudiation, digitalSignature, keyEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = '"$CONTAINER_NAME"' +DNS.2 = localhost +IP.1 = 127.0.0.1 +EOF + + openssl req -new -key /certs/client.key -out /certs/client.csr -config /certs/openssl.cnf && openssl x509 -req -in /certs/client.csr -CA /ca/ca.crt -CAkey /ca/ca.key -CAcreateserial \ - -out /certs/client.crt -days 365 -sha256 && + -out /certs/client.crt -days 365 -sha256 -extensions v3_req -extfile /certs/openssl.cnf && base64 /certs/client.crt > /certs/client_pem.crt && - base64 /certs/client.key > /certs/client_pem.key + base64 /certs/client.key > /certs/client_pem.key && + chown -R '"$(id -u):$(id -g)"' /certs ' cp "$CA_CERT" "$OUTPUT_PATH/peer.crt" From ed312077ff478913e9ee639ad751266d31c4bf5a Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 22 Aug 2025 06:57:57 -0500 Subject: [PATCH 469/471] fix-revert init changes Signed-off-by: Pereowei Daniel --- CHANGELOG.md | 2 - e2e-network/docker/test-01-v2-simple.sh | 2 +- e2e/__snapshots__/fabloCommands.test.ts.snap | 57 +++++++++----------- e2e/fabloCommands.test.ts | 2 +- src/init/index.ts | 8 +-- 5 files changed, 32 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 372b49e30..21f9a4218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,6 @@ * Support installing Chaincode from Docker image using CCaaS [#550](https://github.com/hyperledger-labs/fablo/pull/550) [#582](https://github.com/hyperledger-labs/fablo/pull/582) -* Starting from this PR, `fablo init` command will generate network with TLS enabled and RAFT consensus instead of SOLO with TLS disabled - [#594](https://github.com/hyperledger-labs/fablo/pull/594) ## 2.2.0 diff --git a/e2e-network/docker/test-01-v2-simple.sh b/e2e-network/docker/test-01-v2-simple.sh index e36c0c4df..e6ce2110d 100755 --- a/e2e-network/docker/test-01-v2-simple.sh +++ b/e2e-network/docker/test-01-v2-simple.sh @@ -49,7 +49,7 @@ trap 'networkDown ; echo "Test failed" ; exit 1' ERR SIGINT networkUp waitForContainer "orderer0.group1.orderer.example.com" "Created and started new.*my-channel1" -waitForContainer "ca.org1.example.com" "Listening on https://0.0.0.0:7054" +waitForContainer "ca.org1.example.com" "Listening on http://0.0.0.0:7054" waitForContainer "peer0.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer1.org1.example.com" "Joining gossip network of channel my-channel1 with 1 organizations" waitForContainer "peer0.org1.example.com" "Learning about the configured anchor peers of Org1MSP for channel my-channel1" diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 2021de2b9..54d6853ec 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -2474,20 +2474,15 @@ Validation warnings count: 0 exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 -Validation warnings count: 1 +Validation warnings count: 0 =========================================================== Validation errors count: 0 -Validation warnings count: 1 -=========================================================== -=================== Validation summary ==================== -Warnings found: - Orderer: - - Orderer consesus type is set to 'raft', but number of instances is 1. Network won't be fault tolerant! Consider higher value. +Validation warnings count: 0 =========================================================== { "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker", "fabricToolsVersion": "2.5.12", @@ -2516,7 +2511,7 @@ Warnings found: "ordererGroups": [ { "name": "group1", - "consensus": "etcdraft", + "consensus": "solo", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2530,7 +2525,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2543,7 +2538,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2555,7 +2550,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2569,7 +2564,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2601,7 +2596,7 @@ Warnings found: "ordererGroups": [ { "name": "group1", - "consensus": "etcdraft", + "consensus": "solo", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2615,7 +2610,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2628,7 +2623,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2821,7 +2816,7 @@ Warnings found: ], "ordererGroup": { "name": "group1", - "consensus": "etcdraft", + "consensus": "solo", "configtxOrdererDefaults": "Group1Defaults", "profileName": "Group1Genesis", "genesisBlockName": "Group1Genesis.block", @@ -2835,7 +2830,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2848,7 +2843,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2860,7 +2855,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2872,7 +2867,7 @@ Warnings found: "orgName": "Orderer", "orgMspName": "OrdererMSP", "domain": "orderer.example.com", - "consensus": "etcdraft", + "consensus": "solo", "adminPort": 7053, "port": 7030, "fullAddress": "orderer0.group1.orderer.example.com:7030" @@ -2981,7 +2976,7 @@ exports[`init should init simple fablo config 1`] = ` "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker" }, @@ -2999,7 +2994,7 @@ exports[`init should init simple fablo config 1`] = ` "orderers": [ { "groupName": "group1", - "type": "raft", + "type": "solo", "instances": 1, "prefix": "orderer" } @@ -3049,7 +3044,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker" }, @@ -3067,7 +3062,7 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` "orderers": [ { "groupName": "group1", - "type": "raft", + "type": "solo", "instances": 1, "prefix": "orderer" } @@ -3111,9 +3106,9 @@ exports[`init should init simple fablo config with node chaincode 1`] = ` { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas", + "lang": "node", "channel": "my-channel1", - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "directory": "./chaincodes/chaincode-kv-node", "privateData": [] } ], @@ -3126,7 +3121,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/2.2.0/schema.json", "global": { "fabricVersion": "2.5.12", - "tls": true, + "tls": false, "peerDevMode": false, "engine": "docker" }, @@ -3144,7 +3139,7 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 "orderers": [ { "groupName": "group1", - "type": "raft", + "type": "solo", "instances": 1, "prefix": "orderer" } @@ -3192,9 +3187,9 @@ exports[`init should init simple fablo config with node chaincode and rest api 1 { "name": "chaincode1", "version": "0.0.1", - "lang": "ccaas", + "lang": "node", "channel": "my-channel1", - "image": "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + "directory": "./chaincodes/chaincode-kv-node", "privateData": [] } ], diff --git a/e2e/fabloCommands.test.ts b/e2e/fabloCommands.test.ts index dcb9087d6..946f66015 100644 --- a/e2e/fabloCommands.test.ts +++ b/e2e/fabloCommands.test.ts @@ -82,7 +82,7 @@ describe("validate", () => { // Then expect(commandResult).toEqual(TestCommands.success()); expect(commandResult.output).toContain("Validation errors count: 0"); - expect(commandResult.output).toContain("Validation warnings count: 1"); + expect(commandResult.output).toContain("Validation warnings count: 0"); expect(commands.getFiles()).toContain("e2e/__tmp__/commands-tests/fablo-config.json"); }); diff --git a/src/init/index.ts b/src/init/index.ts index b89163f62..b8f908deb 100644 --- a/src/init/index.ts +++ b/src/init/index.ts @@ -8,7 +8,7 @@ function getDefaultFabloConfig(): FabloConfigJson { $schema: `https://github.com/hyperledger-labs/fablo/releases/download/${version}/schema.json`, global: { fabricVersion: "2.5.12", - tls: true, + tls: false, peerDevMode: false, }, orgs: [ @@ -25,7 +25,7 @@ function getDefaultFabloConfig(): FabloConfigJson { orderers: [ { groupName: "group1", - type: "raft", + type: "solo", instances: 1, prefix: "orderer", }, @@ -64,9 +64,9 @@ function getDefaultFabloConfig(): FabloConfigJson { { name: "chaincode1", version: "0.0.1", - lang: "ccaas", + lang: "node", channel: "my-channel1", - image: "ghcr.io/fablo-io/fablo-sample-kv-node-chaincode:2.2.0", + directory: "./chaincodes/chaincode-kv-node", privateData: [], }, ], From f8d605784f37c7e36da2deb660169c53eb8f5a16 Mon Sep 17 00:00:00 2001 From: Pereowei Daniel <82245725+dpereowei@users.noreply.github.com> Date: Fri, 22 Aug 2025 12:13:57 -0500 Subject: [PATCH 470/471] Update src/validate/index.ts Co-authored-by: Jakub Dzikowski Signed-off-by: Pereowei Daniel <82245725+dpereowei@users.noreply.github.com> --- src/validate/index.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/validate/index.ts b/src/validate/index.ts index 97284b9b7..ed6e25e62 100644 --- a/src/validate/index.ts +++ b/src/validate/index.ts @@ -152,9 +152,6 @@ class ValidateGenerator extends Generator { console.log(`Validation errors count: ${this.errors.count()}`); console.log(`Validation warnings count: ${this.warnings.count()}`); console.log(chalk.bold("===========================================================")); - console.log(`Validation errors count: ${this.errors.count()}`); - console.log(`Validation warnings count: ${this.warnings.count()}`); - console.log(chalk.bold("===========================================================")); } async detailedSummary() { From 95e9bf7e6b8df8212e0f6fcda0b88dcb420acc8b Mon Sep 17 00:00:00 2001 From: Pereowei Daniel Date: Fri, 22 Aug 2025 12:28:43 -0500 Subject: [PATCH 471/471] fix-update snapshots Signed-off-by: Pereowei Daniel --- e2e/__snapshots__/fabloCommands.test.ts.snap | 6 ------ 1 file changed, 6 deletions(-) diff --git a/e2e/__snapshots__/fabloCommands.test.ts.snap b/e2e/__snapshots__/fabloCommands.test.ts.snap index 54d6853ec..7192088ba 100644 --- a/e2e/__snapshots__/fabloCommands.test.ts.snap +++ b/e2e/__snapshots__/fabloCommands.test.ts.snap @@ -4,9 +4,6 @@ exports[`extend config should extend custom config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Validation errors count: 0 -Validation warnings count: 0 -=========================================================== { "global": { "fabricVersion": "2.4.3", @@ -2476,9 +2473,6 @@ exports[`extend config should extend default config 1`] = ` "Validation errors count: 0 Validation warnings count: 0 =========================================================== -Validation errors count: 0 -Validation warnings count: 0 -=========================================================== { "global": { "fabricVersion": "2.5.12",