Welcome to the Linux Foundation Forum!

Lab 5 - error changing anchor peer

Hi,

I have set up network as described in the tutorial. However, in Lab5 when I try to switch anchor peer I receive the following error:

peer channel update -o orderer.example.com:7050 -c allarewelcome -f ./config/changeanchorpeerorg1.tx
2019-07-15 13:27:13.560 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2019-07-15 13:27:13.565 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable

2019-07-15 13:27:13.567 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized

Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'allarewelcome': error authorizing update: error validating ReadSet: proposed update requires that key [Group] /Channel/Application/Org1MSP be at version 0, but it is currently at version 1

I did obviously edit files as described in tutorial, restarted CLI container and set correct admin paths inside the CLI container. However, I still receive the same error. I also checked the ca key in the crypto config, which still match what is written in docker-compose.yml

Any tips? Thanks!

Comments

  • Niklaskkkk
    Niklaskkkk Posts: 113

    Obviously interested in finding the solution, without pruning the network. I guess it should be possible to fix errors without doing that each time :)

  • Niklaskkkk
    Niklaskkkk Posts: 113
    edited July 2019

    Also, is there a spesific command to see who (which peer) is currently anchor peers within a channel? I tried the "peer channel getinfo c- allarewelcome" command, but no info about anchor peers

  • Niklaskkkk
    Niklaskkkk Posts: 113

    I did run the teardown.sh script, and then tried to change anchor peer from peer0 to peer1. As expected, I did work without any issues then. So I assume the issue was related to old certificated being used/referenced?
    However, my question is how to solve this issue without doing the teardown.sh script? Any way to delete old certificated manually?

  • Niklaskkkk
    Niklaskkkk Posts: 113

    STRANGE!
    If I do the same process again (not resetting the network, just trying to change anchor peer) by editing file, recreating transaction and restarting CLI container, the error message appear again!

    :/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel update -o orderer.example.com:7050 -c allarewelcome -f ./config/changeanchorpeerorg1.tx
    2019-07-16 10:00:54.654 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
    2019-07-16 10:00:54.659 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
    2019-07-16 10:00:54.660 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
    Error: got unexpected status: BAD_REQUEST -- error applying config update to existing channel 'allarewelcome': error authorizing update: error validating ReadSet: proposed update requires that key [Group] /Channel/Application/Org1MSP be at version 0, but it is currently at version 1

    Now I also tried changing the admin paths by exporting within CLI container, without help, still same error message. I do not understand why??!

    Does anyone know? @kmyatt

  • indirajith
    indirajith Posts: 44
    edited July 2019

    I will try to provide a vague idea. The error is due to version mismatch. In fabric the configurable elements have versions. So every committed change increases the version of the particular configurable element by one. So, from the error, we can say there has been a change already and you try to change/modify/update the same element again by issuing the same command again so, there is a version mismatch. I am not sure but, I think you have a committed a change already to the application channel.

    I would like to get more details and reasoning from the experts!

  • indirajith
    indirajith Posts: 44

    To my understanding, the application channel is the channel of peers (I don't know why do they call it as such if this is true correct), and anchor peers are per organisation per channel. So, I think you have already updated the anchor peer for org1.

  • Niklaskkkk
    Niklaskkkk Posts: 113

    Thanks for reply @indirajith
    Yeah I was thinking about that, but I am inside the CLI, so I tried to edit the yml file and do it for peer0, or peer1. So the same error message appears, this is why I believe this has to do with old ceritificates maybe instead? I am not sure.

    But it should be possible to switch anchor peers multiple times, with the same procedure, right? Obviously restarting the CLI container after editing the yml file.

    ?

  • Niklaskkkk
    Niklaskkkk Posts: 113

    And what is the command to find out who is currently the anchor peer on the network?

  • to know which the peer anchor you have to do a fetch config
    1) peer channel fetch config /etc/hyperledger/configtx/config-channel.block -c allarewelcome -o orderer.example.com:7050

    2) ../bin/configtxlator proto_decode --input config/config-channel.block --type common.Block >config/config-channel.block.json

    3) inside the json filter anchor that is going to be the anchor peer

  • Here is the answer to this specific issue regarding changing anchor peers multiple times:

    look at the configtxgen documentation ( https://hyperledger-fabric.readthedocs.io/en/release-1.4/commands/configtxgen.html#configtxgen), you'll notice the following:

    -outputAnchorPeersUpdate string
    Creates an config update to update an anchor peer (works only with the default channel creation, and only for the first update)

    The last comment explains the issue: "and only for the first update"

    So you cannot use configtxgen to update the anchor peers more than once and you can only use it if no other channel updates have occurred other than channel creation.

    In order to update several times, you'll need to follow the steps outlined at https://hyperledger-fabric.readthedocs.io/en/release-1.4/config_update.html in order to actually perform subsequent channel updates.

    Developers of Fabric might be making better tooling for this post 2.0, but for now the above is the only documented way to do things.

  • https://medium.com/coinmonks/hyperledger-fabric-updating-channel-configs-45082a5dc9b2

    Please refer to the attached steps for changing the configuration file and updating.

Categories

Upcoming Training