Editing default signature policy for chaincode triggers error while running transactions: received discovery error:failed constructing descriptor for chaincodes. Commercial paper on Test-network #policies #fabric-chaincode #fabric-questions #fabric-endorser
sangieri@...
Using the default configuration I can run all the functions inside the application folder of commercial paper on test-network without any problem If I edit the default signature policy in the approval and commitment of the chaincode definition i am unable to run the issue.js code without experiencing the service discovery error: " Connect to Fabric gateway. Use network channel: mychannel. Use org.papernet.commercialpaper smart contract. Submit commercial paper issue transaction. 2021-03-26T12:05:04.277Z - error: [DiscoveryService]: send[papercontract] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"papercontract" > Error processing transaction. Error: DiscoveryService: papercontract error: failed constructing descriptor for chaincodes:<name:"papercontract" > Error: DiscoveryService: papercontract error: failed constructing descriptor for chaincodes:<name:"papercontract" > at DiscoveryService.send (/home/sangieri/TestProject/commercial-paper/organization/magnetocorp/application/node_modules/fabric-common/lib/DiscoveryService.js:363:11) Disconnect from Fabric gateway. Issue program complete."
According to documentation, to edit the signature policy I use the following commands: peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --signature-policy "OR('Org1.peer', 'Org2.peer')" --name papercontract -v 0 --package-id $PACKAGE_ID --sequence 1 --tls --cafile $ORDERER_CA peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} --channelID mychannel --signature-policy "OR('Org1.peer', 'Org2.peer')" --name papercontract -v 0 --sequence 1 --tls --cafile $ORDERER_CA --waitForEvent
The Anchor peer are set. The connectionOptions in issue.js are set properly: let connectionOptions = { identity: userName, wallet: wallet, discovery: { enabled:true, asLocalhost: true } };
Any help?
|
|
Nikhil Gupta
Hi, Can you confirm that the chaincode has been committed to the channel? Or can you do a docker ps to confirm that the chaincode containers have started. This error looks like the chaincode may not be on the channel. Nik
On Fri, Mar 26, 2021 at 8:35 AM <sangieri@...> wrote:
|
|
sangieri@...
Hi Nik, Thanks for answering.
I confirm the chaincode has been committed to the channel: peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} --channelID mychannel --signature-policy "OR('Org1.peer', 'Org2.peer')" --name papercontract -v 0 --sequence 1 --tls --cafile $ORDERER_CA --waitForEvent 2021-03-26 13:51:22.432 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [a2633e88ce9a337c523dfb24fc33914cb82fb8fadf24b01609331a64d77c0a7b] committed with status (VALID) at localhost:7051 2021-03-26 13:51:22.456 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [a2633e88ce9a337c523dfb24fc33914cb82fb8fadf24b01609331a64d77c0a7b] committed with status (VALID) at localhost:9051
and that all docker containers seem to be properly setup: docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e0dafb74a871 dev-peer0.org2.example.com-cp_0-ddca913c004eb34f36dfb0b4c0bcc6d4afc1fa823520bb5966a3bfcf1808f40a-5c83b377cab7f417bcf7f196e6cbde2f685ab9db73ea78fa733ccb4c3af65781 "docker-entrypoint.s…" 6 seconds ago Up 5 seconds dev-peer0.org2.example.com-cp_0-ddca913c004eb34f36dfb0b4c0bcc6d4afc1fa823520bb5966a3bfcf1808f40a 25f6984c346f dev-peer0.org1.example.com-cp_0-ddca913c004eb34f36dfb0b4c0bcc6d4afc1fa823520bb5966a3bfcf1808f40a-0829f3256ad634f959b8cb39756634e18a5aecbc11e7cc9cdb38c88304e03b4b "docker-entrypoint.s…" 6 seconds ago Up 5 seconds dev-peer0.org1.example.com-cp_0-ddca913c004eb34f36dfb0b4c0bcc6d4afc1fa823520bb5966a3bfcf1808f40a 38ebe71216cc hyperledger/fabric-tools:latest "/bin/bash" 3 minutes ago Up 3 minutes cli 6bb6d323df4a hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:7051->7051/tcp peer0.org1.example.com d16b32dce7b9 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 7051/tcp, 0.0.0.0:9051->9051/tcp peer0.org2.example.com 115460e0646b couchdb:3.1.1 "tini -- /docker-ent…" 3 minutes ago Up 3 minutes 4369/tcp, 9100/tcp, 0.0.0.0:7984->5984/tcp couchdb1 9fb31d32ca3f couchdb:3.1.1 "tini -- /docker-ent…" 3 minutes ago Up 3 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb0 c8795371969d hyperledger/fabric-orderer:latest "orderer" 3 minutes ago Up 3 minutes 0.0.0.0:7050->7050/tcp orderer.example.com 7adfadccb74a hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se…" 3 minutes ago Up 3 minutes 7054/tcp, 0.0.0.0:8054->8054/tcp ca_org2 78f6a1bfd0d4 hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se…" 3 minutes ago Up 3 minutes 0.0.0.0:7054->7054/tcp ca_org1 f1b15beb5920 hyperledger/fabric-ca:latest "sh -c 'fabric-ca-se…" 3 minutes ago Up 3 minutes 7054/tcp, 0.0.0.0:9054->9054/tcp ca_orderer
Stefano
|
|
sangieri@...
Hi Community, Still facing the same issue. Additional log from monitordocker.sh net_test: "peer0.org2.example.com|2021-03-29 12:22:25.948 UTC [discovery] chaincodeQuery -> ERRO 066 Failed constructing descriptor for chaincode chaincodes:<name:"papercontract" > ,: no peer combination can satisfy the endorsement policy" While having two peer should be more than enough for a test policy like this: "OR('Org1.peer', 'Org2.peer')" Any suggestions?
|
|
Nikhil Gupta
You may need to use the MSP ID's of the organizations, rather than the informal names. Try this policy: "OR('Org1MSP.peer','Org2MSP.peer')"
On Mon, Mar 29, 2021 at 8:34 AM <sangieri@...> wrote:
|
|
sangieri@...
Hi Nik, You are right! Defining the policy using the MSP ID's of the organizations, everything works as expected. Thank You. Stefano
|
|