0

I'm using hyperleger fabric V1.4.4, I'm trying to enforce an endorsement policy including 2 organizations when upgrading, but when I do, The discovery service starts failing and the policy gets lost.

I verified that the anchor peers have been defined when joining the channel, so that doesn't seem to be the problem.

This is what I'm doing:

Initially this is the way I instantiated/upgrade my chaincode:

    const gateway = new Gateway();
    await gateway.connect(ccp, { wallet, identity: userId, discovery: { enabled: true, asLocalhost: false } });

    const client = gateway.getClient();
    const network = await gateway.getNetwork(channelName);
    const channel = network.getChannel();
    const peers = client.getPeersForOrg(orgName);

    const txId = client.newTransactionID(true);
    const deployId = txId.getTransactionID();

    var request = {
        targets : peers,
        chaincodeId: ccName,
        chaincodeType: ccType,
        chaincodeVersion: ccVersion,
        fcn: ccFunc,
        args: ccArgs,
        txId: txId
    };
    let upgradeResponse = await channel.sendUpgradeProposal(request, 300000);

This way the contract works the discovery service works too but I don't have the endorsement policy that I need so I changed the code this way:

    var policy = {
        identities: [
          { role: { name: "member", mspId: "org1" }},
          { role: { name: "member", mspId: "org2" }},
        ],
        policy: {
          "2-of": [{ "signed-by": 0 }, { "signed-by": 1 }]
        }
    }

    var request = {
        targets : peers,
        chaincodeId: ccName,
        chaincodeType: ccType,
        chaincodeVersion: ccVersion,
        fcn: ccFunc,
        args: ccArgs,
        txId: tx_id,
        'endorsement-policy': policy
    };

But then the discovery service starts failing with this error:

error: [Channel.js]: Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"mycontract" >

I started looking at the discovery results using await channel.getDiscoveryResults() and I can see that after adding the endorsement policy the endorsement gets lost.

Also I can see from the discovery results that I can only see the peers that I passed from my organization ccp, I don't see all the peers in the network but I can see all the orderers.

I think the problem is that doing the upgrade the discovery doesn't see the peers of all the orgs but I don't understand why.

I've tried removing the peers from the request but that doesn't seem to change the results. also I tried setting both peers in the request and I'm getting the next error:

Error: Peer with name "peer.xxxxxx.eastus.aksapp.io" not assigned to this channel

I've been lost with this issue for a while, is there a way for me to confirm that the anchor peers are working properly? is the way I'm doing the connection using the ccp blocking somehow the discovery process? what can I do to diagnose my problem?

this is how my ccp looks like:

{
  "certificateAuthorities": {
    "org1CA": {
      "caName": "ca.org1",
      "tlsCACerts": {},
      "url": "https://ca.xxxxxxxx.eastus.aksapp.io:443"
    }
  },
  "client": {
    "connection": {
      "timeout": {
        "orderer": "300",
        "peer": {
          "endorser": "300"
        }
      }
    },
    "organization": "org1"
  },
  "name": "org1",
  "organizations": {
    "org1": {
      "certificateAuthorities": [
        "org1CA"
      ],
      "mspid": "org1",
      "peers": [
        "peer1.org1"
      ]
    }
  },
  "peers": {
    "peer1.org1": {
      "grpcOptions": {
        "hostnameOverride": "peer1.xxxxxxxxxx.eastus.aksapp.io",
        "ssl-target-name-override": "peer1.xxxxxxxxxx.eastus.aksapp.io"
      },
      "tlsCACerts": {},
      "url": "grpcs://peer1.xxxxxxxxxx.eastus.aksapp.io:443"
    }
  },
  "version": "1.0.0",
  "wallet": "org1"
}

Thank you very much

Ana Franco
  • 1,611
  • 3
  • 24
  • 43
  • Open a JIRA issue in jira.hyperledger.org – yacovm Aug 23 '20 at 11:54
  • 1
    You can look what chaincodes each peer has installed or which peers see other peers in the network by using the CLI - https://hyperledger-fabric.readthedocs.io/en/latest/discovery-cli.html and using the membership query. also can you attach the logs of the peers to your question, and also the output of the discovery CLI ? – yacovm Aug 23 '20 at 11:57
  • I opened this jira https://jira.hyperledger.org/browse/FAB-18184?focusedCommentId=70042&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-70042 Thanks! – Ana Franco Aug 25 '20 at 12:03
  • Yes I've noticed. If your problem doesn't get solved soon, you can try and send me a message in chat.hyperledger.org but keep in mind I only check it about once per day – yacovm Aug 25 '20 at 22:32
  • Thanks to @yacovm help changing anchor peers and surfing the blockchain the endoresement policy started working. all details are in the Jira issue – Ana Franco Aug 27 '20 at 17:47

0 Answers0