Search code examples
blockchainhyperledger-fabrichyperledger-caliper

Error: Connection profiles for the organization(s) 'manufacturerMSP' have been specified as discover which is not allowed


i am trying to test my hyperledger code with caliper and when im trying to run this command

npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig caliper-config.yaml --caliper-benchconfig ../benchmark/caliper-test.yaml --caliper-flow-only-test

im getting this error

Failed round 1 (Create a Medicine): Error: Error: Connection profiles for the organization(s) 'manufacturerMSP' have been specified as discover which is not allowed
    at WorkerOrchestrator.updateWorkerPhase (/home/hyperledger/code/medtrac/network/node_modules/@hyperledger/caliper-core/lib/manager/orchestrators/worker-orchestrator.js:306:61)
    at ProcessMessenger.messenger.on (/home/hyperledger/code/medtrac/network/node_modules/@hyperledger/caliper-core/lib/manager/orchestrators/worker-orchestrator.js:109:18)
    at ProcessMessenger.emit (events.js:189:13)
    at ProcessMessenger.onMessage (/home/hyperledger/code/medtrac/network/node_modules/@hyperledger/caliper-core/lib/common/messengers/messenger-interface.js:40:14)
    at ChildProcess.workerProcess.on (/home/hyperledger/code/medtrac/network/node_modules/@hyperledger/caliper-core/lib/common/messengers/process/process-messenger.js:59:26)
    at ChildProcess.emit (events.js:189:13)
    at emit (internal/child_process.js:820:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

this is the caliper-config.yaml

name: Caliper Benchmarks
version: "2.0.0"

caliper:
  blockchain: fabric
  roundDuration: 30
  sutOptions:
    network-configuration-path: '../application/connection-profiles/connection-profile-manufacturer.yaml'
    network-configuration-file: 'connection-profile-manufacturer.yaml'
    endorsement-policy: "AND('manufacturerMSP.peer')"
    channel-id: medtracchannel
    orderer-id: 'orderer.medtrac-network.com'

channels:
  # channelName of medtracchannel matches the name of the channel created by test network
  - channelName: medtracchannel
    # the chaincodeIDs of all the fabric chaincode in caliper-benchmarks
    contracts:
    - id: medtraccontract

organizations:
  - mspid: manufacturerMSP
    # Identities come from cryptogen created material for test-network
    identities:
      certificates:
      - name: manufacturer
        clientPrivateKey:
          path: './crypto-config/peerOrganizations/manufacturer.medtrac-network.com/peers/peer0.manufacturer.medtrac-network.com/msp/keystore/b48573b89dc0476861ef7e71f895e1be0f8050a59d3567a9db9cb849c9d32117_sk'
        clientSignedCert:
          path: './crypto-config/peerOrganizations/manufacturer.medtrac-network.com/peers/peer0.manufacturer.medtrac-network.com/msp/signcerts/peer0.manufacturer.medtrac-network.com-cert.pem'
    connectionProfile:
      path: '../application/connection-profiles/connection-profile-manufacturer.yaml' 
      discover: true

this is caliper-test.yaml

test:
  workers:
    number: 2
  rounds:
    - label: Create a Medicine
      txNumber: 5
      rateControl:
          type: fixed-load
          opts:
            transactionLoad: 5
      workload:
        module: ../benchmark/createMedicine.js

and this is createMedicine.js

'use strict';

const { WorkloadModuleBase } = require('@hyperledger/caliper-core');

/**
 * Workload module for creating medicine records in the supply chain tracking system.
 */
class CreateMedicineWorkload extends WorkloadModuleBase {
    /**
     * Initializes the workload module instance.
     */
    constructor() {
        super();
        this.txIndex = 0;
    }

    /**
     * Assemble transactions for the workload round.
     * @return {Promise<TxStatus[]>}
     */
    async submitTransaction() {
        this.txIndex++;
        const drugName = 'Medicine' + this.txIndex.toString();
        const serialNo = 'SERIAL' + this.txIndex.toString();
        const mfgDate = '2023-07-21';
        const expDate = '2024-12-31';
        const companyCRN = 'MAN001'; 

        let args = {
            contractId: 'org.medtrac-network.medtracnet',
            contractVersion: '1.0',
            contractFunction: 'addDrug',
            contractArguments: [drugName, serialNo, mfgDate, expDate, companyCRN],
            timeout: 30 
        };

        await this.sutAdapter.sendRequests(args);
    }
}

/**
 * Create a new instance of the workload module.
 * @return {WorkloadModuleInterface}
 */
function createWorkloadModule() {
    return new CreateMedicineWorkload();
}

module.exports.createWorkloadModule = createWorkloadModule;

please let me know where how to solve this error i have tried changing the peers, this is the connection-profile for manufacturer

name: "network_medtrac-registration"

x-type: "hlfv1"

description: "Medtrac Network"

version: "1.0"

client:
  organization: manufacturer
  connection:
    timeout:
      peer:
        endorser: 300
        eventHub: 300
        eventReg: 300
      orderer: 300

channels:
  medtracchannel:
    orderers:
      - orderer.medtrac-network.com
    peers:
      peer0.manufacturer.medtrac-network.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
organizations:
manufacturer:
    mspid: manufacturerMSP
    peers:
      - peer0.manufacturer.medtrac-network.com
      - peer1.manufacturer.medtrac-network.com
    certificateAuthorities:
      - ca.manufacturer.medtrac-network.com

and also let me know if any other information is needed

I have tried chainging the code ... there is no discovery on connection-profile and i dont know where the error is coming from


Solution

  • For Caliper, there are 2 types of connection profiles you can reference, static and dynamic (as defined by Hyperledger Fabric). Dynamic connection profiles only provide enough information to communicate with 1 or more peers and you use it to discover the network topology (discover: true needs to be specified in the caliper network config file). Static connection profiles provide the complete information about the network topology (discover: false needs to be specified in the caliper network configuration file). In your case you have selected to bind to the fabric 1.4 node sdk (when you bound to fabric:1.4) and when you launch caliper you don't specify the gateway option so caliper uses the low level api of the fabric 1.4 node sdk and can only use static connection profiles. The connection profile you have given appears to be a static connection profile, so you can fix the issue by setting discover: false in your network configuration file you called caliper-config.yaml