hyperledger / caliper

A blockchain benchmark framework to measure performance of multiple blockchain solutions https://wiki.hyperledger.org/display/caliper
https://hyperledger.github.io/caliper/
Apache License 2.0
642 stars 403 forks source link

TypeError: Cannot convert undefined or null to object #1502

Open keshny-pixel opened 1 year ago

keshny-pixel commented 1 year ago

Which Caliper version are you using?

0.5.0

Which Node.JS version are you using?

10.19.0

Which operating system are you using?

WSL

Please provide some context for your error. For example, when did the error occur? What were you trying to achieve, and how?

I ran the command below: caliper launch manager --caliper-workspace cwk/blockchain_DEP/caliper-benchmarks/src/ethereum/simple --caliper-benchconfig cwk/blockchain_DEP/caliper-benchmarks/benchmarks/scenario/simple/config.yaml --caliper-networkconfig cwk/blockchain_DEP/caliper-benchmarks/networks/ethereum/1node-clique/networkconfig.json

It connected to my local blockchain but does not run my benchmarks.

I then ran the command below in another terminal: caliper launch manager --caliper-workspace cwk/blockchain_DEP/caliper-benchmarks/src/ethereum/simple --caliper-benchconfig cwk/blockchain_DEP/caliper-benchmarks/benchmarks/scenario/simple/config.yaml --caliper-networkconfig cwk/blockchain_DEP/caliper-benchmarks/networks/ethereum/1node-clique/networkconfig.json --caliper-flow-only-test

I got the error: [caliper] [caliper-worker] Worker [0] encountered an error during prepare test phase for round 0: TypeError: Cannot convert undefined or null to object at Function.keys () at EthereumConnector.getContext (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-ethereum/lib/ethereum-connector.js:164:34) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async CaliperWorker.prepareTest (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/caliper-worker.js:157:23) at async WorkerMessageHandler._handlePrepareMessage (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/worker-message-handler.js:210:13) at async ProcessMessenger. (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/worker-message-handler.js:89:13)

What was the observed incorrect behavior?

The command: caliper launch manager --caliper-workspace cwk/blockchain_DEP/caliper-benchmarks/src/ethereum/simple --caliper-benchconfig cwk/blockchain_DEP/caliper-benchmarks/benchmarks/scenario/simple/config.yaml --caliper-networkconfig cwk/blockchain_DEP/caliper-benchmarks/networks/ethereum/1node-clique/networkconfig.json

is not generating results for my benchmarks. It is simply connecting my local blockchain.

When I use the command : caliper launch manager --caliper-workspace cwk/blockchain_DEP/caliper-benchmarks/src/ethereum/simple --caliper-benchconfig cwk/blockchain_DEP/caliper-benchmarks/benchmarks/scenario/simple/config.yaml --caliper-networkconfig cwk/blockchain_DEP/caliper-benchmarks/networks/ethereum/1node-clique/networkconfig.json --caliper-flow-only-test

I get the TypeError: Cannot convert undefined or null to object

Please provide the error logs and their surroundings.

[caliper] [caliper-worker]        Worker [0] encountered an error during prepare test phase for round 0: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at EthereumConnector.getContext (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-ethereum/lib/ethereum-connector.js:164:34)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async CaliperWorker.prepareTest (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/caliper-worker.js:157:23)
    at async WorkerMessageHandler._handlePrepareMessage (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/worker-message-handler.js:210:13)
    at async ProcessMessenger.<anonymous> (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/worker-message-handler.js:89:13)                   

error [caliper] [worker-message-handler]        Error while handling "prepare" message for Worker (12314): TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at EthereumConnector.getContext (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-ethereum/lib/ethereum-connector.js:164:34)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async CaliperWorker.prepareTest (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/caliper-worker.js:157:23)
    at async WorkerMessageHandler._handlePrepareMessage (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/worker-message-handler.js:210:13)
    at async ProcessMessenger.<anonymous> (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/worker/worker-message-handler.js:89:13)
2023.06.12-16:00:48.525 error [caliper] [round-orchestrator]    Failed round 1 (add-evidence): Error: TypeError: Cannot convert undefined or null to object
    at WorkerOrchestrator.updateWorkerPhase (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/orchestrators/worker-orchestrator.js:306:61)
    at ProcessMessenger.<anonymous> (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/orchestrators/worker-orchestrator.js:109:18)
    at ProcessMessenger.emit (events.js:400:28)
    at ProcessMessenger.onMessage (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/common/messengers/messenger-interface.js:40:14)
    at ChildProcess.<anonymous> (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/common/messengers/process/process-messenger.js:59:26)
    at ChildProcess.emit (events.js:400:28)
    at emit (internal/child_process.js:935:14)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
2023.06.12-16:00:48.526 info  [caliper] [report-builder]        ### All test results ###
2023.06.12-16:00:48.527 error [caliper] [report-builder]        No data within test result; implies error within configuration files
2023.06.12-16:00:48.528 error [caliper] [round-orchestrator]    Error while finalizing the report: Error: unrecognized report table
    at ReportBuilder.setSummaryTable (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/report/report-builder.js:142:19)
    at Report.printResultsByRound (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/report/report.js:182:28)
    at RoundOrchestrator.run (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/orchestrators/round-orchestrator.js:230:25)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async CaliperEngine.run (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:153:17)
    at async Function.handler (cwk/blockchain_DEP/caliper-benchmarks/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:30)

Please provide your benchmark configuration file content, if possible.

test:
  name: digital-evidence-benchmark
  description: Benchmark for DigitalEvidence contract
  workers:
    type: local
    number: 1
  rounds:
    - label: add-evidence
      description: Test for addEvidence function
      txNumber: 10
      rateControl: 
        type: fixed-rate
        opts:
          tps: 10
      callback: digital-evidence
      workload:
        module: cwk/blockchain_DEP/caliper-benchmarks/benchmarks/scenario/simple/digital-evidence.js
        arguments:
          - testimony
          - test
          - QmSeYtTTbdCk59xoX3KgYFxbnutbgGCJ17CSq6gndVMfxP

Please provide your network configuration file content, if possible.

{
  "caliper": {
    "blockchain": "ethereum",
    "command": {
      "start": "ganache-cli --hostname 0.0.0.0 --gasLimit 6721975 --accounts 10 --hardfork istanbul --port 8545 ",
      "end": "pkill -f ganache-cli"
    },
    "workspace": "cwk/blockchain_DEP/caliper-benchmarks/src/ethereum/simpleP"
  },
  "ethereum": {
    "url": "ws://localhost:8545",
    "fromAddress": "0x58b0e92F6da4FB1538aDcA40C07829f08858305b",
    "fromPassword": "",
    "deploy": {
      "contracts": [
        {
          "name": "DigitalEvidence",
          "path": "cwk/blockchain_DEP/build/contracts/DigitalEvidence.json"
        }
      ]
    }    
  },
  "accounts": {
    "mnemonic": "around firm mistake match custom window cloud need erode heart glare bless",
    "amount": 10
  }
}

Please provide your workload module content, if possible.

'use strict';

class AddEvidenceWorkload {
    constructor() {
        this.contractId = 'DigitalEvidence';
        this.workerIndex = null;
    }

    async initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext) {
        this.workerIndex = workerIndex;
        this.roundArguments = roundArguments;
        console.log(`Initializing workload module for worker ${workerIndex}`);
    }

    async submitTransaction(sutAdapter, sutContext, workerIndex, txnArguments) {
        if (this.workerIndex === null) {
            throw new Error('Worker index is null. Make sure it is properly initialized.');
        }

        const myArgs = {
            contractId: this.contractId,
            contractFunction: 'addEvidence',
            contractArguments: [txnArguments.evidenceType, txnArguments.description, txnArguments.fileHash],
            invokerIdentity: this.workerIndex.toString(),
            readOnly: false,
        };

        await sutAdapter.sendRequests(myArgs);
    }
}

function createWorkloadModule() {
    return new AddEvidenceWorkload();
}

module.exports.createWorkloadModule = createWorkloadModule;

Please provide any additional information you deem relevant to the error.

No response