Hyperledger Caliper事务生命周期错误:对等点2建议的响应错误未知:访问被拒绝的通道[]创建者组织

问题描述 投票:1回答:1

我想使用Hyperledger Caliper测试我的链码,但是遇到了一些问题。超级账本结构网络由byfn.sh up命令启动。

我使用命令npx caliper benchmark run --caliper-workspace . --caliper-benchconfig benchmarks/benchmark.yaml --caliper-networkconfig benchmarks/network.yaml运行基准测试。错误日志如下:

Benchmark for target Blockchain type fabric about to start
2020.01.09-23:49:05.146 info  [caliper] [benchmark-validator]   No observer specified, will default to `none`
2020.01.09-23:49:05.147 info  [caliper] [caliper-flow]  ####### Caliper Test #######
2020.01.09-23:49:05.151 info  [caliper] [null-observer]         Configured observer
2020.01.09-23:49:05.154 info  [caliper] [adapters/fabric]       Fabric SDK version: 1.4.3; TLS: server
2020.01.09-23:49:05.155 warn  [caliper] [adapters/fabric]       Org1's registrar information not provided.
2020.01.09-23:49:05.155 warn  [caliper] [adapters/fabric]       Org2's registrar information not provided.
2020.01.09-23:49:05.385 warn  [caliper] [adapters/fabric]       Org1's admin's materials found locally in file system key-value stores. Make sure it is the right one!
2020.01.09-23:49:05.395 warn  [caliper] [adapters/fabric]       Org2's admin's materials found locally in file system key-value stores. Make sure it is the right one!
2020.01.09-23:49:05.411 warn  [caliper] [adapters/fabric]       client0.org1.example.com's materials found locally in file system key-value stores. Make sure it is the right one!
2020.01.09-23:49:05.421 warn  [caliper] [adapters/fabric]       client0.org2.example.com's materials found locally in file system key-value stores. Make sure it is the right one!
2020.01.09-23:49:05.422 info  [caliper] [adapters/fabric]       Channel 'mychannel' is configured as created, skipping creation
2020.01.09-23:49:05.463 info  [caliper] [adapters/fabric]       peer0.org1.example.com has already joined mychannel
2020.01.09-23:49:05.480 info  [caliper] [adapters/fabric]       peer0.org2.example.com has already joined mychannel
2020.01.09-23:49:05.482 info  [caliper] [adapters/fabric]       Installing chaincodes for mychannel...
2020.01.09-23:49:05.491 info  [caliper] [adapters/fabric]       [email protected] is already installed on peer0.org1.example.com
2020.01.09-23:49:05.498 info  [caliper] [adapters/fabric]       [email protected] is already installed on peer0.org2.example.com
2020.01.09-23:49:05.508 info  [caliper] [adapters/fabric]       [email protected] is already installed on peer0.org1.example.com
2020.01.09-23:49:05.515 info  [caliper] [adapters/fabric]       [email protected] is already installed on peer0.org2.example.com
2020.01.09-23:49:05.526 info  [caliper] [adapters/fabric]       [email protected] is already installed on peer0.org1.example.com
2020.01.09-23:49:05.533 info  [caliper] [adapters/fabric]       [email protected] is already installed on peer0.org2.example.com
2020.01.09-23:49:05.534 info  [caliper] [adapters/fabric]       Instantiating [email protected] in mychannel. This might take some time...
2020.01.09-23:49:05.543 info  [caliper] [adapters/fabric]       [email protected] is already instantiated in mychannel
2020.01.09-23:49:05.544 info  [caliper] [adapters/fabric]       Instantiating [email protected] in mychannel. This might take some time...
2020.01.09-23:49:05.554 info  [caliper] [adapters/fabric]       [email protected] is already instantiated in mychannel
2020.01.09-23:49:05.554 info  [caliper] [adapters/fabric]       Instantiating [email protected] in mychannel. This might take some time...
2020.01.09-23:49:05.564 info  [caliper] [adapters/fabric]       [email protected] is already instantiated in mychannel
2020.01.09-23:49:07.566 info  [caliper] [caliper-flow]  Started monitors successfully
2020.01.09-23:49:07.567 info  [caliper] [defaultTest]   ####### Testing 'upload' #######
2020.01.09-23:49:07.568 info  [caliper] [defaultTest]   ------ Test round 1 ------
2020.01.09-23:49:07.582 info  [caliper] [client.js]     Launching client with PID 
2020.01.09-23:49:07.583 info  [caliper] [client.js]     Waiting for 1 clients to be ready... 
2020.01.09-23:49:09.482 info  [caliper] [client.js]     Client ready message received
2020.01.09-23:49:09.481 info  [caliper] [fabric/fabricClientWorker]     Client ready
2020.01.09-23:49:09.482 info  [caliper] [client.js]     1 clients ready, starting test phase
2020.01.09-23:49:09.484 info  [caliper] [local-client.js]       txUpdateTime: 1000
2020.01.09-23:49:09.626 info  [caliper] [local-client.js]       Info: client 2183 init test :invoke
2020.01.09-23:49:10.627 info  [caliper] [local-client.js]       Info: client 2183 start test runFixedNumber():invoke
2020.01.09-23:49:10.650 error [caliper] [adapters/fabric]       Transaction[4751ea2b2c] life-cycle errors:
        - Proposal response error by peer0.org1.example.com: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
        - Proposal response error by peer0.org2.example.com: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]

我认为这可能是tls或加密材料的问题,但是我检查了加密材料的路径没有发现任何问题,以下是我的network.yaml:

name: Fabric
version: "1.0"
mutual-tls: false

caliper:
  blockchain: fabric
  # command:
  #   start: ./byfn.sh up && docker exec cli bash ./scripts/setup4peers.sh && docker exec cli bash ./scripts/joinuser4peers.sh "user1"
  #   end: docker kill $(docker ps -q) && ./byfn.sh down

info:
  Version: 1.4.3
  Size: 2 Orgs with 1 Peer
  Orderer: Solo
  Distribution: Single Host
  StateDB: GoLevelDB

clients:
  client0.org1.example.com:
    client:
      organization: Org1
      credentialStore:
        path: /tmp/hfc-kvs/org1
        cryptoStore:
          path: /tmp/hfc-cvs/org1
      clientPrivateKey:
        path: crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/04650a709ab38a8024c6168344688e1b16a29a7b4d435bc864628ac2afc251bb_sk
      clientSignedCert:
        path: crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]

  client0.org2.example.com:
    client:
      organization: Org2
      credentialStore:
        path: /tmp/hfc-kvs/org2
        cryptoStore:
          path: /tmp/hfc-cvs/org2
      clientPrivateKey:
        path: crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore/2190942bdaa028b7e21802e6aa210add753b466210fcac136374fb0b37d24307_sk
      clientSignedCert:
        path: crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts/[email protected]


channels:
  mychannel:
    configBinary: ../channel-artifacts/channel.tx
    created: true
    orderers:
    - orderer.example.com
    peers:
      peer0.org1.example.com:
        eventSource: true
      # peer1.org1.example.com:
      #   eventSource: true      
      peer0.org2.example.com:
        eventSource: true
      # peer1.org2.example.com:
      #   eventSource: true
    chaincodes:
    - id: automaster_route
      version: "1.0"
      language: java
      path: ../chaincode/master-liuqi/java
      # created: true

    - id: exp0
      version: "1.0"
      language: java
      path: ../chaincode/exp
      # created: true

    - id: exp1
      version: "1.0"
      language: java
      path: ../chaincode/exp
      # created: true

organizations:
  Org1:
    mspid: Org1MSP
    peers:
    - peer0.org1.example.com
    # certificateAuthorities:
    # - ca.org1.example.com
    adminPrivateKey:
      path: crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/67bdf39a46463e67fa8d317fe181c4c32ea371e1d4d40175a78c6ed6137410b5_sk
    signedCert:
      path: crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]

  Org2:
    mspid: Org2MSP
    peers:
    - peer0.org2.example.com
    # certificateAuthorities:
    # - ca.org2.example.com
    adminPrivateKey:
      path: crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/keystore/43432725a9c2b277991c413607326bf2f68932cd99a980183e2487926341583a_sk
    signedCert:
      path: crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts/[email protected]

orderers:
  orderer.example.com:
    url: grpcs://localhost:7050
    grpcOptions:
      ssl-target-name-override: orderer.example.com
    tlsCACerts:
      path: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
      # crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
peers:
  peer0.org1.example.com:
    url: grpcs://localhost:7051
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
      grpc.keepalive_time_ms: 600000
    tlsCACerts:
      path: crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem
      # crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem


  peer0.org2.example.com:
    url: grpcs://localhost:9051
    grpcOptions:
      ssl-target-name-override: peer0.org2.example.com
      grpc.keepalive_time_ms: 600000
    tlsCACerts:
      path: crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem
      # crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp/tlscacerts/tlsca.org2.example.com-cert.pem


  # peer1.org1.example.com:
  #   url: grpc://localhost:8051
  #   grpcOptions:
  #     ssl-target-name-override: peer1.org1.example.com
  #     grpc.keepalive_time_ms: 600000

  # peer1.org2.example.com:
  #   url: grpc://localhost:10051
  #   grpcOptions:
  #     ssl-target-name-override: peer1.org2.example.com
  #     grpc.keepalive_time_ms: 600000

有人知道如何解决此问题吗?

hyperledger-fabric hyperledger grpc caliper chaincode
1个回答
0
投票

如果使用卡尺基准,那么问题出在node_modules / @ hyperledger / caliper-fabric / lib。你应该打开那个文件,并将行760(async_initializeChannel)更改为此:

async _initializeChannel(profiles, channel) {
    // initialize the channel for every client profile from the local config
    for (let profile of profiles.entries()) {
        let orgs = this.networkUtil.getOrganizationsOfChannel(channel);
        for (let org of orgs) {
            if (profile[0]===org){
                let ch = profile[1].getChannel(channel, true);
                if (ch) {
                    try {
                        await ch.initialize();
                    } catch (err) {
                        logger.error(`Couldn't initialize ${channel} for ${profile[0]}: ${err.message}`);
                        throw err;
                    }
                }
            }
        }
    }
}

如果不是从那里发来的,则还有另外两个概率:来自network.yaml(1)或expo链码基准java文件配置(2)。

((1)通常,如果有两个以上的组织,仅通过此文件中的客户端配置,就更容易建立从属组织。只需删除clientPrivateKey和clientSignedCert并添加从属关系即可。例如:

client0.org1.example.com:
    client:
        organization: Org1
        affiliation: org1.department1
        credentialStore:
            path: /tmp/hfc-kvs/org1
            cryptoStore:
                path: /tmp/hfc-cvs/org1

((2)从您的chaincode基准java文件配置中,应添加您的invokerIdentity

其他两个问题实际上已经在hyperledger caliper网站上提供了有关织物配置的信息

© www.soinside.com 2019 - 2024. All rights reserved.