minifabric icon indicating copy to clipboard operation
minifabric copied to clipboard

Add 2 new organizations to existing network

Open dilumb opened this issue 3 years ago • 2 comments

I'm working on a multi-channel setup where some organizations need to be added to multiple channels. Following is the high-level network setup:

network1 - org1, org2, orderer1 (1 peer each) - channel1
network2 - org3 (1 peer)
network3 - org4 (1 peer)

All networks are set up using netup as I don't want to install chaincode at the time of network init (even if I install something, I'll need to install more chaincodes once the network is running). However, I ran channelcreate,channeljoin,anchorupdate on network1 which has channel1. Also, orgjoin is used to connect network2 and network3 channel1 one after another. All steps run without any errors and I see channelquery including all 4 organizations.

The problem comes when I try to install chaincode. I'm unable to commit as I can't collect the 3 endorsements (4 organizations) only from 2 organizations in network 1. Following is the specific error and it seems this is related to issue #199

  The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'Layouts'

  The error appears to be in '/home/playbooks/common/peerselection.yaml': line 25, column 5, but may
  be elsewhere in the file depending on the exact syntax problem.

  The offending line appears to be:

    - name: Select a random endorser group
      ^ here

I suspect network3 was not completely/correctly added to channel1 as I never did a channelsign from org3. Hence, I also tried 3. New organization to application channel (Fast Way) steps mentioned in AddNewOrganization.md. However, I can't figure out how to do the step where it says "The signed file will have to be passed from one org to the other so that all the endorsements are gathered when channel update command runs." While I copied channel2_update_envelope.pb from network1 to network 2 I still can't sign it because channelsign try to rebuild it.

Also, note that if I only connect org3 to network1 (i.e., org1, org2) I can install, initialize, and invoke chaincode. The problem just comes when I add org4. Also, adding more peers for org1 and org2 isn't desirable as we are going to use this on K8s for a PoC. Further, I prefer not to downgrade endorsement policy from MAJORITY to ANY Appreciate any tips on how to resolve this issue.

dilumb avatar Aug 06 '21 11:08 dilumb

Looking into the problem further my vars/discover/channel1/simple_endorsers.json file is empty on all networks. I suspect this lead to the above error. Also, I wonder whether not calling anchorupdate after adding other 2 networks lead this issue. So I tried that. But now getting the following error:

  non-zero return code
  2021-08-23 10:00:35.183 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
  2021-08-23 10:00:35.196 UTC [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /vars/configtx.yaml
  2021-08-23 10:00:35.196 UTC [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
  2021-08-23 10:00:35.198 UTC [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
  2021-08-23 10:00:35.238 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
  Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'channel1': error authorizing update: error validating ReadSet: proposed update requires that key [Group]  /Channel/Application be at version 1, but it is currently at version 2```

dilumb avatar Aug 23 '21 10:08 dilumb

Found the issue with anchorupdate. Apparently anchorupdate.j2 uses configtxgen -outputAnchorPeersUpdate which is deprecated. Also, it only works for the first update of the default channel creation. Fixed anchorupdate.j2 to use configtxlator instead. I'll do a pull request for this. Other issues to still unresolved.

dilumb avatar Aug 24 '21 10:08 dilumb