【发布时间】:2021-01-27 08:28:58
【问题描述】:
Caliper (v.0.4.2) 已安装并在我的机器(笔记本电脑)上设置配置,并准备与 google-cloud 中现有的已部署结构网络进行通信。为了沟通这两个 caliper 和 fabric 网络,我提供了 org1 的连接配置文件(部署了我的合约)。我发现错误并没有解决。
如何解决这个错误?
错误:找不到合同 ID 的详细信息
以下是查找给定问题的解决方案的信息。
Caliper 正在使用以下命令启动
gopal@gopal:~/workspace/newcalliper/caliper-workspace$ npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig networks/networkConfig.yaml --caliper-benchconfig benchmarks/myAssetBenchmark.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled
networkConfig 上的设置:
name: Fabric Calier test network
version: "2.0.0"
caliper:
blockchain: fabric
sutOptions:
mutualTls: false
channels:
- channelName: mychannel
contract:
- id: abc
organizations:
- mspid: Org1MSP
identities:
certificates:
- name: 'adminorg1'
admin: true
clientPrivateKey:
path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/crypto-config/peerOrganizations/org1.example.com/msp/keystore/key.pem'
clientSignedCert:
path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/crypto-config/peerOrganizations/org1.example.com/msp/signcerts/cert.pem'
connectionProfile:
path: '../fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml'
discover: false
基准配置:
test:
name: basic-contract-benchmark
description: test benchmark
workers:
type: local
number: 1
rounds:
- label: readAsset
description: Read asset benchmark
txDuration: 5
rateControl:
type: fixed-load
opts:
transactionLoad: 1
workload:
module: workload/readAsset.js
arguments:
contractId: abc
readAsset.js 并提交交易:
'use strict';
const { WorkloadModuleBase } = require('@hyperledger/caliper-core');
class MyWorkload extends WorkloadModuleBase {
constructor() {
super();
}
// this initializeWorkloadModule is called by the workloadeModuleBase.js from the caliper inside.
//and send to sutAdptor as a request to simulate.
async initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext) {
await super.initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext);
const request = {
contractId: this.roundArguments.contractId,
contractFunction: 'GetAllAssetCategory',
invokerIdentity: 'adminorg1',
contractArguments: [],
readOnly: false
};
await this.sutAdapter.sendRequests(request);
}
async submitTransaction() {
const myArgs = {
contractId:this.roundArguments.contractId,
contractFunction: 'GetAllAssetCategory',
invokerIdentity: 'adminorg1',
contractArguments: [],
readOnly: false,
targetPeers:['peer0.org1.exmple.com'],
targetOrganizations:['peer0.org1.example.com'],
orderer:['orderer0.org1.example.com'],
channel:['mychannel']
};
await this.sutAdapter.sendRequests(myArgs);
}
async cleanupWorkloadModule() {
for (let i=0; i<this.roundArguments.assets; i++) {
const assetID = `${this.workerIndex}_${i}`;
console.log(`Worker ${this.workerIndex}: Deleting asset ${assetID}`);
const request = {
contractId: this.roundArguments.contractId,
contractFunction: 'GetAllAssetCategory',
invokerIdentity: 'adminorg1',
contractArguments: [],
readOnly: false
};
await this.sutAdapter.sendRequests(request);
}
}
}
function createWorkloadModule() {
return new MyWorkload();
}
module.exports.createWorkloadModule = createWorkloadModule;
卡尺日志:
2021.01.26-23:11:54.759[32m info [39m [caliper] [caliper-worker] Info: worker 0 prepare test phase for round 0 is starting...
2021.01.26-23:11:54.764[90m debug[39m [caliper] [workload-module-base] Workload module initialized with: workerIndex=0, totalWorkers=1, roundIndex=0, roundArguments={"contractId":"abc"}
**2021.01.26-23:11:54.771[32m info [39m [caliper] [caliper-worker] Worker [0] encountered an error during prepare test phase for round 0: Error: Could not find details for contract ID abc
at V2FabricGateway._sendSingleRequest (/home/gopal/node_modules/@hyperledger/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:156:23)**
at V2FabricGateway.sendRequests (/home/gopal/node_modules/@hyperledger/caliper-core/lib/common/core/connector-base.js:78:39)
at MyWorkload.initializeWorkloadModule (/home/gopal/workspace/newcalliper/caliper-workspace/workload/readAsset.js:20:35)
at process._tickCallback (internal/process/next_tick.js:68:7)
2021.01.26-23:11:54.772[32m info [39m [caliper] [caliper-worker] Info: worker 0 prepare test phase for round 0 is completed
2021.01.26-23:11:54.773[90m debug[39m [caliper] [process-messenger] Process "10624" sent message: {"sender":"10624","recipients":["10611"],"type":"prepared","content":{},"date":"2021-01-26T17:26:54.773Z","error":"Error: Could not find details for contract ID abc"}
2021.01.26-23:11:54.774[31m error[39m [caliper] [worker-message-handler] Error while handling "prepare" message for Worker (10624): Error: Could not find details for contract ID abc
at V2FabricGateway._sendSingleRequest (/home/gopal/node_modules/@hyperledger/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:156:23)
at V2FabricGateway.sendRequests (/home/gopal/node_modules/@hyperledger/caliper-core/lib/common/core/connector-base.js:78:39)
at MyWorkload.initializeWorkloadModule (/home/gopal/workspace/newcalliper/caliper-workspace/workload/readAsset.js:20:35)
at process._tickCallback (internal/process/next_tick.js:68:7)
2021.01.26-23:11:54.793[90m debug[39m [caliper] [process-messenger] Process "10624" handling message: {"sender":"10611","recipients":["all"],"type":"exit","content":{},"date":"2021-01-26T17:26:54.793Z"}
2021.01.26-23:11:54.798[90m debug[39m [caliper] [worker-message-handler] Handling "exit" message for Worker (10624): {"sender":"10611","recipients":["all"],"type":"exit","content":{},"date":"2021-01-26T17:26:54.793Z"}
2021.01.26-23:11:54.799[32m info [39m [caliper] [worker-message-handler] Worker#0 is exiting
2021.01.26-23:11:54.799[90m debug[39m [caliper] [worker-message-handler] Handled "exit" message for Worker (10624)
此外,当discover: true 用于连接配置文件时,只有对等方将控制台上的信息显示为
2021-01-27 14:25:22.811 UTC [comm.grpc.server] 1 -> INFO 098 unary call completed grpc.service=discovery.Discovery grpc.method=Discover grpc.peer_address=202.52.76.41:33878 grpc.peer_subject="CN=fabric-common" grpc.code=OK grpc.call_duration=1.059889ms
但是,orderer 和 CA 都没有显示使用 gateway 作为事务提交的 caliper 请求的任何信息。 caliper 控制台还显示以下错误:
2021.01.27-19:25:35.887 info [caliper] [connectors/v2/FabricGateway] Successfully connected user with identity adminorg1 to a Network Gateway
2021.01.27-19:25:35.892 info [caliper] [connectors/v2/FabricGateway] Generating contract map for user adminorg1
2021-01-27T13:40:39.803Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer0.org1.example.com:7050, url:grpcs://localhost:7050, connected:false, connectAttempted:true
2021-01-27T13:40:39.808Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer0.org1.example.com:7050 url:grpcs://localhost:7050 timeout:3000
2021-01-27T13:40:39.810Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer0.org1.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer0.org1.example.com:7050, url:grpcs://localhost:7050, connected:false, connectAttempted:true
2021-01-27T13:40:42.844Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com:7051, url:grpcs://localhost:7051, connected:false, connectAttempted:true
2021-01-27T13:40:42.844Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com:7051 url:grpcs://localhost:7051 timeout:3000
2021-01-27T13:40:42.845Z - error: [DiscoveryService]: _buildPeer[mychannel] - Unable to connect to the discovered peer peer0.org1.example.com:7051 due to Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com:7051, url:grpcs://localhost:7051, connected:false, connectAttempted:true
2021.01.27-19:25:42.854 info [caliper] [caliper-worker] Info: worker 0 prepare test phase for round 0 is starting...
2021.01.27-19:25:42.861 info [caliper] [caliper-worker] Worker [0] encountered an error during prepare test phase for round 0: Error: Could not find details for contract ID abc
编辑:添加了discover true 和 false case 的附加设置结果,以清楚地定义问题。
谢谢!
【问题讨论】:
-
在给定链接中提出了相关问题,但未解决且未完全解释。在这里,stackoverflow.com/questions/65296447/…
-
如果发现:true,我希望我的远程机器 IP 而不是给定信息卡尺控制台中的本地主机。这是详细信息:2021-01-27T13:40:42.845Z - 错误:[DiscoveryService]:_buildPeer[mychannel] - 无法连接到发现的对等 peer0.org1.example.com:7051 由于错误:之前无法连接Endorser-name 的截止日期:peer0.org1.example.com:7051, url:grpcs://localhost:7051, connected:false, connectAttempted:true
-
如果发现:true,我发现如果合约 ID 设置不正确,那么它会抛出连接配置文件中提供的 IP 错误。查看结果:2021-01-27T14:55:41.676Z - 错误:[ServiceEndpoint]: waitForReady - 无法连接到远程 gRPC 服务器 orderer0.org1.example.com url:grpcs://35.224.172.187:7050 超时: 3000 .
-
如果 discover 设置为 true,要阻止底层 node-sdk 将 url 转换为 localhost,您还需要在命令行中指定
--caliper-fabric-gateway-localhost=false。 -
在我的测试中,--caliper-fabric-gateway-localhost=false 并没有影响我在 discover 中的基准测试:false,并且仍然给了我相同的完整测试结果和报告。并且这个完整的测试可以在远程机器上使用 discover: true 和 false 进行。在使用 --caliper-fabric-gateway-localhost=false 时,discover: false 没有给出任何错误,但 discover:true 给出的错误为:error: [DiscoveryService]。
标签: hyperledger-fabric hyperledger-caliper