fablo icon indicating copy to clipboard operation
fablo copied to clipboard

Installing the same chaincode on two channels

Open rrozek opened this issue 2 years ago • 3 comments

Hi, tremendous progress in fablo 1.1.0! However i noticed, that I cannot install the same chaincode on two separate channels. My config is for 2 orgs, 2 peer per org, 1 channel per org and i want to install the same chaincode on both channels. It fails on:

Generating network config
    FABLO_VERSION:      1.1.0
    FABLO_CONFIG:       custom-config-2org-2peer-1channel-per-org.json
    FABLO_NETWORK_ROOT: /home/jrojek/dvnt/repo/open-pay-api/configs/fablo/fablo-target
Validation errors count: 1
Validation warnings count: 0
===========================================================
=================== Validation summary ====================
Errors found:
  Chaincode:
   - Chaincode name 'chaincode-test' is not unique.
===========================================================

config i tried:

{
  "$schema": "https://github.com/hyperledger-labs/fablo/releases/download/1.1.0/schema.json",
  "global": {
    "fabricVersion": "2.4.3",
    "tls": true
  },
  "orgs": [
    {
      "organization": {
        "name": "Orderer",
        "mspName": "OrdererMSP",
        "domain": "root.com"
      },
      "ca":  {
        "prefix": "ca"
      },
      "orderers": [
        {
          "groupName": "group1",
          "type": "raft",
          "instances": 3
        }
      ],
    },
    {
      "organization": {
        "name": "Org1",
        "mspName": "Org1MSP",
        "domain": "org1.com"
      },
      "ca":  {
        "prefix": "ca"
      },
      "peer": {
        "instances": 2,
        "anchorPeerInstances": 2,
        "db": "CouchDb"
      },
      "tools": {
        "fabloRest": true
      }
    },
    {
      "organization": {
        "name": "Org2",
        "mspName": "Org2MSP",
        "domain": "org2.com"
      },
      "ca":  {
        "prefix": "ca"
      },
      "peer": {
        "instances": 2,
        "anchorPeerInstances": 2,
        "db": "CouchDb"
      },
      "tools": {
        "fabloRest": true
      }
    }
  ],
  "channels": [
    {
      "name": "channel1-org1",
      "orgs": [
        {
          "name": "Org1",
          "peers": [
            "peer0",
            "peer1"
          ]
        }
      ]
    },
    {
      "name": "channel1-org2",
      "orgs": [
        {
          "name": "Org2",
          "peers": [
            "peer0",
            "peer1"
          ]
        }
      ]
    }
  ],
  "chaincodes": [
    {
      "name": "chaincode-test",
      "version": "1.0.0",
      "lang": "node",
      "channel": "channel1-org1",
      "directory": "./chaincodes/chaincode-test"
    },
    {
      "name": "chaincode-test",
      "version": "1.0.0",
      "lang": "node",
      "channel": "channel1-org2",
      "directory": "./chaincodes/chaincode-test"
    }
  ]
}

i can workaround it by setting different name but the same source directory, however it would be convinient if it could go under the same name.

  "chaincodes": [
    {
      "name": "chaincode-test-channel1-org1",
      "version": "1.0.0",
      "lang": "node",
      "channel": "channel1-org1",
      "directory": "./chaincodes/chaincode-test"
    },
    {
      "name": "chaincode-test-channel1-org2",
      "version": "1.0.0",
      "lang": "node",
      "channel": "channel1-org2",
      "directory": "./chaincodes/chaincode-test"
    }
  ]

rrozek avatar Aug 16 '22 05:08 rrozek

Hey @rrozek thanks for kind words :)
About the issue - yes, it's a known problem reported here.
We'll try to fix it soon, so I'm leaving the issue opened and will let you know when it happens :)

Hejwo avatar Aug 17 '22 15:08 Hejwo

huh. was looking in open issues and didn't find it -_-' sorry for duplicate!

rrozek avatar Aug 17 '22 16:08 rrozek

probably a solution for this issue is to use in Fablo docker mounts for directories like channel-name/chaincode-name instead of just chaincode-name. It will allow to avoid duplicate mounts error

dzikowski avatar Aug 30 '23 10:08 dzikowski