Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to upgrade chaincode on Fabric 1.4 peer #600

Open
celder628 opened this issue May 14, 2022 · 1 comment
Open

Failed to upgrade chaincode on Fabric 1.4 peer #600

celder628 opened this issue May 14, 2022 · 1 comment

Comments

@celder628
Copy link

celder628 commented May 14, 2022

This issue was found while upgrading chaincode on a 1.4 peer.

The issue is in plugins/module_utils/peers.py

Line 233:

                    p = re.compile('^Name: (.+), Version: (.+), Path: (.+),(?: Input: (.+),)? Escc: (.+), Vscc: (.+)$')

Should be:

                    p = re.compile('^Name: (.+), Version: (.+),(?: Path: (.+),)?(?: Input: (.+),)? Escc: (.+), Vscc: (.+)$')

Path may not necessarily be set. This causes any chaincode that does not return a path to be excluded from the list of instantiated chaincodes and the chaincode upgrade subsequently fails.

The following is the peer command listing installed and instantiated chaincodes.
marbles2 is node chaincode
marbles3 is golang chaincode

peer chaincode list -o n60cd63-orderer21.celder3-b3c-4x16-334e19b56347d9ce32b6d6a870d14f37-0000.us-south.containers.appdomain.cloud:7050 -C channel1 --tls --cafile /Users/celder/fabric/dev/ansible_dest/debug/orderercert.pem --installed
Get installed chaincodes on peer:
Name: marbles2, Version: 1.0.7, Path: /Users/celder/Developer/go/src/github.com/hyperledger/fabric-samples/chaincode/marbles04/node, Id: cbffee7ec43c91caa5adc6ccfaa6e7cebb3179e09f1c56284a5782e388d52fd3
Name: marbles3, Version: 5.0.0, Path: marbles3, Id: 5d25430e24c256d36f789192bb2570e69fff7533c73d061e332c0d82718842e1
peer chaincode list -o n60cd63-orderer21.celder3-b3c-4x16-334e19b56347d9ce32b6d6a870d14f37-0000.us-south.containers.appdomain.cloud:7050 -C channel1 --tls --cafile /Users/celder/fabric/dev/ansible_dest/debug/orderercert.pem --instantiated
Get instantiated chaincodes on channel channel1:
Name: marbles2, Version: 1.0.6, Escc: escc, Vscc: vscc
Name: marbles3, Version: 5.0.0, Path: marbles3, Input: <nil>, Escc: escc, Vscc: vscc
$ peer version
peer:
 Version: 2.2.0
 Commit SHA: 5ea85bc54
 Go version: go1.14.4
 OS/Arch: darwin/amd64
 Chaincode:
  Base Docker Label: org.hyperledger.fabric
  Docker Namespace: hyperledger

I applied this locally and the upgrade succeeded. I need to run another test to followup.

@celder628
Copy link
Author

After a few trials, I came up with a match that handles the missing parameter cases:

                p = re.compile('^Name: (.+), Version: ([^\s]*),(?: Path: ([^\s]*),)?(?: Input: ([^\s]*),)? Escc: (.+), Vscc: (.+)$')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant