使用 Fabric 2.1 运行 Hyperledger Caliper V0.4.2 时出现验证错误

发布于 2025-01-12 04:43:00 字数 3637 浏览 0 评论 0原文

当我运行 Caliper V0.4.2 来测量 Fabric 2.1.0 1.4.7 的基准时,出现以下错误

ValidationError: child "version" fails because ["version" must be one of [1.0]]. child "clients" fails because ["clients" is required]. child "channels" fails because ["channels" must be an object]. child "organizations" fails because ["organizations" must be an object]. child "orderers" fails because ["orderers" is required]. child "peers" fails because ["peers" is required]

    at Object.exports.process (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hapi/joi/lib/errors.js:202:19)
    at internals.Object._validateWithOptions (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hapi/joi/lib/types/any/index.js:763:31)
    at module.exports.internals.Any.root.validate (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hapi/joi/lib/index.js:145:23)
    at Function._validateTopLevel (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/configValidator.js:208:26)
    at Function.validateNetwork (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/configValidator.js:58:25)
    at new FabricConnector (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/fabric-connector.js:107:25)
    at CaliperEngine.connectorFactory [as adapterFactory] (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/connectorFactory.js:26:23)
    at CaliperEngine.run (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:93:36)
    at Function.handler (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:43)
    at Object.module.exports.handler (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-cli/lib/launch/launchManagerCommand.js:46:44)
  isJoi: true,
  name: 'ValidationError',
  details:
   [ { message: '"version" must be one of [1.0]',
       path: [Array],
       type: 'any.allowOnly',
       context: [Object] },
     { message: '"clients" is required',
       path: [Array],
       type: 'any.required',
       context: [Object] },
     { message: '"channels" must be an object',
       path: [Array],
       type: 'object.base',
       context: [Object] },
     { message: '"organizations" must be an object',
       path: [Array],
       type: 'object.base',
       context: [Object] },
     { message: '"orderers" is required',
       path: [Array],
       type: 'any.required',
       context: [Object] },
     { message: '"peers" is required',
       path: [Array],
       type: 'any.required',
       context: [Object] } ],
  _object:
   { name: 'Caliper Benchmarks',
     version: '2.1.0',
     caliper: { blockchain: 'fabric' },
     channels: [ [Object] ],
     organizations: [ [Object] ] },
  annotate: [Function] }

我运行的命令是,

npm init -y

npm install --only=prod @hyperledger/[电子邮件受保护]

npx caliper 绑定 --caliper-bind-sut Fabric:2.1

./network.sh deployCC -ccn simple -ccp ../../caliper-benchmarks /src/fabric/scenario/simple/node -ccl javascript

npx caliper 启动管理器 --caliper-workspace ./ --caliper-networkconfig 网络/fabric/test-network.yaml --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-flow-only- test --caliper-fabric-gateway-enabled

Hyperledger 网络创建、通道创建和 Chaincode 部署均成功。

如何解决这个错误?

When I have been running the Caliper V0.4.2 for measuring the benchmarks of Fabric 2.1.0 1.4.7, I got the below error

ValidationError: child "version" fails because ["version" must be one of [1.0]]. child "clients" fails because ["clients" is required]. child "channels" fails because ["channels" must be an object]. child "organizations" fails because ["organizations" must be an object]. child "orderers" fails because ["orderers" is required]. child "peers" fails because ["peers" is required]

    at Object.exports.process (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hapi/joi/lib/errors.js:202:19)
    at internals.Object._validateWithOptions (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hapi/joi/lib/types/any/index.js:763:31)
    at module.exports.internals.Any.root.validate (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hapi/joi/lib/index.js:145:23)
    at Function._validateTopLevel (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/configValidator.js:208:26)
    at Function.validateNetwork (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/configValidator.js:58:25)
    at new FabricConnector (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/fabric-connector.js:107:25)
    at CaliperEngine.connectorFactory [as adapterFactory] (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-fabric/lib/connectorFactory.js:26:23)
    at CaliperEngine.run (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:93:36)
    at Function.handler (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:43)
    at Object.module.exports.handler (/home/gow/fabric-benchmarks/caliper-benchmarks/node_modules/@hyperledger/caliper-cli/lib/launch/launchManagerCommand.js:46:44)
  isJoi: true,
  name: 'ValidationError',
  details:
   [ { message: '"version" must be one of [1.0]',
       path: [Array],
       type: 'any.allowOnly',
       context: [Object] },
     { message: '"clients" is required',
       path: [Array],
       type: 'any.required',
       context: [Object] },
     { message: '"channels" must be an object',
       path: [Array],
       type: 'object.base',
       context: [Object] },
     { message: '"organizations" must be an object',
       path: [Array],
       type: 'object.base',
       context: [Object] },
     { message: '"orderers" is required',
       path: [Array],
       type: 'any.required',
       context: [Object] },
     { message: '"peers" is required',
       path: [Array],
       type: 'any.required',
       context: [Object] } ],
  _object:
   { name: 'Caliper Benchmarks',
     version: '2.1.0',
     caliper: { blockchain: 'fabric' },
     channels: [ [Object] ],
     organizations: [ [Object] ] },
  annotate: [Function] }

Command that I run are,

npm init -y

npm install --only=prod @hyperledger/[email protected]

npx caliper bind --caliper-bind-sut fabric:2.1

./network.sh deployCC -ccn simple -ccp ../../caliper-benchmarks/src/fabric/scenario/simple/node -ccl javascript

npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig networks/fabric/test-network.yaml --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled

Hyperledger network creation, channel creation and Chaincode deployment all were successful.

How to solve this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你爱我像她 2025-01-19 04:43:00

看起来您正在使用卡尺基准的主要分支。我建议您 https://github.com/ hyperledger/caliper-benchmarks/blob/main/networks/fabric/README.md

根据您发布的内容,您应该使用最新的可用版本的 caliper 0.4.2,而不是 0.4.0。为此,您应该发出的命令是

npm install --only=prod @hyperledger/caliper-cli

您应该绑定到最新的 2.2 sdk(不要绑定到 2.1,因为 Fabric 不支持 2.1)。请注意,这是选择用于与交换矩阵网络交互的 sdk 版本,而不是您正在使用的交换矩阵网络的版本。 2.2 将适用于 Fabric 2.2 及更高版本的 2.x

npx caliper bind --caliper-bind-sut fabric:2.2

最后,您似乎尝试更改网络配置文件中的版本号。不要更改版本(它必须是 2.0.0),因为它指的是网络配置文件的版本,而不是您要测试的结构的版本

当您希望使用测试网络时,取决于哪个分支您正在使用的织物样本定义了织物的版本。主分支测试了最新版本的fabric,应该没有问题。

Looks like you are using the main branch of caliper-benchmarks. I would suggest you https://github.com/hyperledger/caliper-benchmarks/blob/main/networks/fabric/README.md

From what you have posted, you should use the latest available version of caliper which is 0.4.2, not 0.4.0. To do so the command you should issue is

npm install --only=prod @hyperledger/caliper-cli

You should bind to the latest 2.2 sdk (don't bind to 2.1 as fabric doesn't support 2.1). Note this is selecting the version of the sdk used to interact with a fabric network, not the version of the fabric network you are using. 2.2 will work with a fabric 2.2 and later 2.x versions

npx caliper bind --caliper-bind-sut fabric:2.2

Finally it looks like you tried to change the version number in the network configuration file. Don't change the version (it must be 2.0.0) as it refers to the version of the network configuration file and not the version of fabric you want to test

As you look to be using test-network, depending on which branch of fabric-samples you are using defines the version of fabric. The main branch tests the latest version of fabric which should have no problems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文