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
651 stars 404 forks source link

Caliper using v1 connector even when SUT set to 2 #1250

Closed m0bi5 closed 2 years ago

m0bi5 commented 2 years ago

Which Caliper version are you using?

v0.4.2

Which Node.JS version are you using?

10.22

Which operating system are you using?

Alpine

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

I am building caliper from source in a docker container -

FROM node:10.22-alpine
RUN apk add --no-cache python g++ make git
RUN mkdir -p /hyperledger/caliper/workspace
RUN mkdir caliper
RUN chown -R node hyperledger/
RUN chown -R node caliper/
RUN chown -R node /usr/local/lib
USER node:node
RUN git clone https://github.com/hyperledger/caliper
RUN cd caliper && git checkout v0.4.2
COPY FabricGateway.js ./caliper/packages/caliper-fabric/lib/connector-versions/v2/FabricGateway.js
RUN cd caliper && npm install && npm run repoclean -- --yes && npm run bootstrap
WORKDIR /hyperledger/caliper/workspace
ENV CALIPER_WORKSPACE=/hyperledger/caliper/workspace
ENV CALIPER_BIND_ARGS -g
RUN mkdir /usr/local/lib/.npm-global/lib/node_modules
RUN npm config set prefix "/usr/local/lib/.npm-global"
ENV NODE_PATH /usr/local/lib/.npm-global
ENV PATH /usr/local/lib/.npm-global:$PATH
ENTRYPOINT ["node", "/caliper/packages/caliper-cli/caliper.js"]

And I run it using the following docker-compose file

version: '2'
networks:
  byfn:
    external:
      name: first-network

services:
  caliper:
    container_name: caliper
    image: m0bi5/caliper
    command: launch manager --caliper-fabric-gateway-localhost false --caliper-workspace ./ --caliper-networkconfig /hyperledger/caliper/workspace/networks/networkConfig.yaml --caliper-benchconfig /hyperledger/caliper/workspace/benchmarks/myAssetBenchmark.yaml --caliper-bind-sut fabric:2.2 --caliper-flow-only-test --caliper-fabric-gateway-enabled --caliper-fabric-timeout-invokeorquery 60000 --caliper-fabric-timeout-chaincodeinstantiate 60000 --caliper-fabric-timeout-chaincodeinstantiateevent 60000
    volumes:
      - ./caliper-workspace:/hyperledger/caliper/workspace
      - ./swarm-networks/2host-swarm:/hyperledger/caliper
    networks: 
      - byfn

What was the observed incorrect behavior?

Caliper uses the v1 FabricGateway even when I pass the --caliper-bind-sut fabric:2.2 flag. It works as expected when I use the hyperledger/caliper:0.4.2 image so I think it has something to do with the local installation.

Please provide the error logs and their surroundings.

Creating caliper ... done
Attaching to caliper
caliper    | 2022.03.03-13:52:30.027 info  [caliper] [cli-launch-manager]       Binding specification is present, performing binding for "fabric:2.2"
caliper    | 2022.03.03-13:52:30.030 warn  [caliper] [bind]     Working directory not specified. Using "/hyperledger/caliper/workspace"
caliper    | 2022.03.03-13:52:30.030 info  [caliper] [bind]     User-provided arguments for npm: "-g"
caliper    | 2022.03.03-13:52:30.030 info  [caliper] [bind]     Binding for fabric@2.2. This might take some time...
caliper    | 2022.03.03-13:52:30.030 info  [caliper] [bind]     Using working directory: /hyperledger/caliper/workspace
caliper    | 2022.03.03-13:52:30.031 info  [caliper] [bind]     Calling npm with: install -g fabric-network@2.2.3 fabric-ca-client@2.2.3
caliper    | npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
caliper    | npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
caliper    | npm WARN deprecated cloudant-follow@0.18.2: This package is no longer maintained.
caliper    | npm WARN deprecated har-validator@5.1.5: this library is no longer supported
caliper    | npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
.
.
.
caliper    | make: Leaving directory '/usr/local/lib/.npm-global/lib/node_modules/fabric-network/node_modules/pkcs11js/build'
caliper    | 
caliper    | > protobufjs@6.11.2 postinstall /usr/local/lib/.npm-global/lib/node_modules/fabric-ca-client/node_modules/protobufjs
caliper    | > node scripts/postinstall
caliper    | 
caliper    | 
caliper    | > protobufjs@6.11.2 postinstall /usr/local/lib/.npm-global/lib/node_modules/fabric-network/node_modules/protobufjs
caliper    | > node scripts/postinstall
caliper    | 
caliper    | + fabric-network@2.2.3
caliper    | + fabric-ca-client@2.2.3
caliper    | added 187 packages from 167 contributors in 53.412s
caliper    | 2022.03.03-13:53:23.956 info  [caliper] [cli-launch-manager]       Set workspace path: /hyperledger/caliper/workspace
caliper    | 2022.03.03-13:53:23.957 info  [caliper] [cli-launch-manager]       Set benchmark configuration path: /hyperledger/caliper/workspace/benchmarks/myAssetBenchmark.yaml
caliper    | 2022.03.03-13:53:23.957 info  [caliper] [cli-launch-manager]       Set network configuration path: /hyperledger/caliper/workspace/networks/networkConfig.yaml
caliper    | 2022.03.03-13:53:23.958 info  [caliper] [cli-launch-manager]       Set SUT type: fabric
caliper    | 2022.03.03-13:53:24.013 info  [caliper] [benchmark-validator]      No observer specified, will default to `none`
caliper    | 2022.03.03-13:53:24.013 info  [caliper] [caliper-engine]   Starting benchmark flow
caliper    | 2022.03.03-13:53:24.664 info  [caliper] [fabric-connector]         Initializing gateway connector compatible with installed SDK: 1.4.19
caliper    | 2022.03.03-13:53:24.755 info  [caliper] [IdentityManager]  Adding User1 (admin=false) as User1 for organization Org1MSP
caliper    | 2022.03.03-13:53:24.998 info  [caliper] [caliper-engine]   Skipping start commands due to benchmark flow conditioning
caliper    | 2022.03.03-13:53:24.999 info  [caliper] [caliper-engine]   Skipping initialization phase due to benchmark flow conditioning
caliper    | 2022.03.03-13:53:24.999 info  [caliper] [caliper-engine]   Skipping install smart contract phase due to benchmark flow conditioning
caliper    | 2022.03.03-13:53:25.001 info  [caliper] [monitor.js]       No resource monitors specified
caliper    | 2022.03.03-13:53:25.003 info  [caliper] [default-observer]         Observer interval set to 5000 seconds
caliper    | 2022.03.03-13:53:25.005 info  [caliper] [round-orchestrator]       Preparing worker connections
caliper    | 2022.03.03-13:53:25.006 info  [caliper] [worker-orchestrator]      Launching worker 1 of 1
caliper    | 2022.03.03-13:53:25.012 info  [caliper] [worker-orchestrator]      Messenger not configured, entering configure phase...
caliper    | 2022.03.03-13:53:25.013 info  [caliper] [worker-orchestrator]      No existing workers detected, entering worker launch phase...
caliper    | 2022.03.03-13:53:25.013 info  [caliper] [worker-orchestrator]      Waiting for 1 workers to be connected...
caliper    | 2022.03.03-13:53:25.442 info  [caliper] [cli-launch-worker]        Worker is a locally forked process, skipping binding step already performed by the manager process
caliper    | 2022.03.03-13:53:25.443 info  [caliper] [cli-launch-worker]        Set workspace path: /hyperledger/caliper/workspace
caliper    | 2022.03.03-13:53:25.444 info  [caliper] [cli-launch-worker]        Set benchmark configuration path: /hyperledger/caliper/workspace/benchmarks/myAssetBenchmark.yaml
caliper    | 2022.03.03-13:53:25.444 info  [caliper] [cli-launch-worker]        Set network configuration path: /hyperledger/caliper/workspace/networks/networkConfig.yaml
caliper    | 2022.03.03-13:53:25.444 info  [caliper] [cli-launch-worker]        Set SUT type: fabric
caliper    | 2022.03.03-13:53:25.493 info  [caliper] [worker-orchestrator]      1 workers connected, progressing to worker assignment phase.
caliper    | 2022.03.03-13:53:25.494 info  [caliper] [worker-orchestrator]      Workers currently unassigned, awaiting index assignment...
caliper    | 2022.03.03-13:53:25.494 info  [caliper] [worker-orchestrator]      Waiting for 1 workers to be assigned...
caliper    | 2022.03.03-13:53:25.532 info  [caliper] [worker-orchestrator]      1 workers assigned, progressing to worker initialization phase.
caliper    | 2022.03.03-13:53:25.532 info  [caliper] [worker-orchestrator]      Waiting for 1 workers to be ready...
caliper    | 2022.03.03-13:53:26.416 info  [caliper] [worker-orchestrator]      1 workers ready, progressing to test preparation phase.
caliper    | 2022.03.03-13:53:26.417 info  [caliper] [round-orchestrator]       Started round 1 (Store)
caliper    | 2022.03.03-13:53:26.802 info  [caliper] [worker-message-handler]   Initializing Worker#0...
caliper    | 2022.03.03-13:53:26.802 info  [caliper] [fabric-connector]         Initializing gateway connector compatible with installed SDK: 1.4.19
caliper    | 2022.03.03-13:53:26.802 info  [caliper] [IdentityManager]  Adding User1 (admin=false) as User1 for organization Org1MSP
caliper    | 2022.03.03-13:53:26.803 info  [caliper] [worker-message-handler]   Worker#0 initialized
caliper    | 2022.03.03-13:53:26.803 info  [caliper] [worker-message-handler]   Preparing Worker#0 for Round#0
caliper    | 2022.03.03-13:53:26.803 info  [caliper] [connectors/v1/FabricGateway]      Connecting user with identity User1 to a Network Gateway
caliper    | 2022.03.03-13:53:26.803 info  [caliper] [connectors/v1/FabricGateway]      Successfully connected user with identity User1 to a Network Gateway
caliper    | 2022.03.03-13:53:26.803 info  [caliper] [connectors/v1/FabricGateway]      Generating contract map for user User1
caliper    | 2022.03.03-13:53:26.843 info  [caliper] [caliper-worker]   Info: worker 0 prepare test phase for round 0 is starting...
caliper    | 2022.03.03-13:53:26.852 info  [caliper] [caliper-worker]   Info: worker 0 prepare test phase for round 0 is completed
caliper    | 2022.03.03-13:53:26.852 info  [caliper] [worker-message-handler]   Worker#0 prepared for Round#0
caliper    | 2022.03.03-13:53:26.854 info  [caliper] [worker-orchestrator]      1 workers prepared, progressing to test phase.
caliper    | 2022.03.03-13:53:26.855 info  [caliper] [round-orchestrator]       Monitors successfully started
caliper    | 2022.03.03-13:53:26.856 info  [caliper] [worker-message-handler]   Worker#0 is starting Round#0
caliper    | 2022.03.03-13:53:26.861 info  [caliper] [caliper-worker]   Worker #0 starting workload loop
caliper    | 2022-03-03T13:53:26.865Z - error: [Transaction]: verifyArguments: Transaction arguments must be strings: 1355960796385, "blue", "20", "penguin", "500"
caliper    | 2022.03.03-13:53:26.866 error [caliper] [connectors/v1/FabricGateway]      Failed to perform submit transaction [CreateStoreAsset] using arguments [1355960796385,blue,20,penguin,500],  with error: Error: Transaction arguments must be strings: 1355960796385, "blue", "20", "penguin", "500"
caliper    |     at verifyArguments (/caliper/node_modules/fabric-network/lib/transaction.js:34:9)
caliper    |     at Transaction.submit (/caliper/node_modules/fabric-network/lib/transaction.js:156:3)
caliper    |     at V1FabricGateway._submitOrEvaluateTransaction (/caliper/packages/caliper-fabric/lib/connector-versions/v1/FabricGateway.js:383:44)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-03-03T13:53:27.059Z - error: [Transaction]: verifyArguments: Transaction arguments must be strings: 1041877621602, "blue", "20", "penguin", "500"
caliper    | 2022.03.03-13:53:27.059 error [caliper] [connectors/v1/FabricGateway]      Failed to perform submit transaction [CreateStoreAsset] using arguments [1041877621602,blue,20,penguin,500],  with error: Error: Transaction arguments must be strings: 1041877621602, "blue", "20", "penguin", "500"
caliper    |     at verifyArguments (/caliper/node_modules/fabric-network/lib/transaction.js:34:9)
caliper    |     at Transaction.submit (/caliper/node_modules/fabric-network/lib/transaction.js:156:3)
caliper    |     at V1FabricGateway._submitOrEvaluateTransaction (/caliper/packages/caliper-fabric/lib/connector-versions/v1/FabricGateway.js:383:44)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-03-03T13:53:27.259Z - error: [Transaction]: verifyArguments: Transaction arguments must be strings: 579335630680, "blue", "20", "penguin", "500"
caliper    | 2022.03.03-13:53:27.259 error [caliper] [connectors/v1/FabricGateway]      Failed to perform submit transaction [CreateStoreAsset] using arguments [579335630680,blue,20,penguin,500],  with error: Error: Transaction arguments must be strings: 579335630680, "blue", "20", "penguin", "500"
caliper    |     at verifyArguments (/caliper/node_modules/fabric-network/lib/transaction.js:34:9)
caliper    |     at Transaction.submit (/caliper/node_modules/fabric-network/lib/transaction.js:156:3)
caliper    |     at V1FabricGateway._submitOrEvaluateTransaction (/caliper/packages/caliper-fabric/lib/connector-versions/v1/FabricGateway.js:383:44)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-03-03T13:53:27.459Z - error: [Transaction]: verifyArguments: Transaction arguments must be strings: 946082815769, "blue", "20", "penguin", "500"
caliper    | 2022.03.03-13:53:27.459 error [caliper] [connectors/v1/FabricGateway]      Failed to perform submit transaction [CreateStoreAsset] using arguments [946082815769,blue,20,penguin,500],  with error: Error: Transaction arguments must be strings: 946082815769, "blue", "20", "penguin", "500"
caliper    |     at verifyArguments (/caliper/node_modules/fabric-network/lib/transaction.js:34:9)
caliper    |     at Transaction.submit (/caliper/node_modules/fabric-network/lib/transaction.js:156:3)
caliper    |     at V1FabricGateway._submitOrEvaluateTransaction (/caliper/packages/caliper-fabric/lib/connector-versions/v1/FabricGateway.js:383:44)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-03-03T13:53:27.658Z - error: [Transaction]: verifyArguments: Transaction arguments must be strings: 773283190773, "blue", "20", "penguin", "500"
caliper    | 2022.03.03-13:53:27.659 error [caliper] [connectors/v1/FabricGateway]      Failed to perform submit transaction [CreateStoreAsset] using arguments [773283190773,blue,20,penguin,500],  with error: Error: Transaction arguments must be strings: 773283190773, "blue", "20", "penguin", "500"
caliper    |     at verifyArguments (/caliper/node_modules/fabric-network/lib/transaction.js:34:9)
caliper    |     at Transaction.submit (/caliper/node_modules/fabric-network/lib/transaction.js:156:3)
caliper    |     at V1FabricGateway._submitOrEvaluateTransaction (/caliper/packages/caliper-fabric/lib/connector-versions/v1/FabricGateway.js:383:44)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022.03.03-13:53:28.762 info  [caliper] [connectors/v1/FabricGateway]      disconnecting gateway for user User1
caliper    | 2022.03.03-13:53:28.763 info  [caliper] [worker-message-handler]   Worker#0 finished 


### Please provide your benchmark configuration file content, if possible.

_No response_

### Please provide your network configuration file content, if possible.

_No response_

### Please provide your workload module content, if possible.

_No response_

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

_No response_
davidkel commented 2 years ago

Unfortunately what you are trying to do isn't supported. There are (horrible) tricks to make it work and that is currently how the caliper integration tests make it work but it isn't right. There is a plan to alter this in the main branch of caliper and make it so the integration tests test in a more natural way while still working direct from source code.

Why are you using the caliper source rather than the pre-packaged node modules or even the caliper docker image which uses the pre-packaged node modules ?

m0bi5 commented 2 years ago

@davidkel So that I can implement what you have said in #1245. Or will that work without having to build caliper from source?

davidkel commented 2 years ago

@m0bi5 I have a PR awaiting review to fix that issue and once it's merged there will be an unstable caliper build which would include it (both a npm module and a docker image) Another way you could do this would be to install the npm module when building your docker image then patch the file rather than cloning the source. It should be easy to do that approach.

davidkel commented 2 years ago

@m0bi5 the fix has been merged and should be in available using docker pull hyperledger/caliper:0.5.0-unstable-20220304102214 as well as an npm module for the cli npm install @hyperledger/caliper-cli@0.5.0-unstable-20220304102214

m0bi5 commented 2 years ago

@davidkel Thanks a lot, the release works!