hyperledger / fabric

Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.
https://wiki.hyperledger.org/display/fabric
Apache License 2.0
15.55k stars 8.79k forks source link

no peer combination can satisfy the endorsement policy #4439

Open RajanHarshit opened 10 months ago

RajanHarshit commented 10 months ago

Description

Hi, I am using :- (As per 2.5.4 release note)

GO v1.20.6 FABRIC v2.5.4 FABRIC-SAMPLE v2.4.9 (latest tag) COUCH_DB v3.3.2 CA_VERSION v1.5.6

I am using fabric-sample's chaincode which is located at path fabric-sample/asset-transfer-basic/chaincode-javascript This chaincode has function , named createAsset. used for adding asset record on blockchain.

When I am invoking this function from Node SDK (api client), I am getting below error.

ERROR [discovery] chaincodeQuery -> Failed constructing descriptor for chaincode chaincodes:<name:"asset-transfer-basic" > : no peer combination can satisfy the endorsement policy

While chaincode deployment , I am passing --signature-policy "OR(Org1MSP.peer)" flag

Steps to reproduce

  1. Start fabric network with FABRIC v2.2.2, COUCH v3.1.1, CA v1.5.2, ORDERER v2.2.2
  2. Deploy chaincode on this fabric network with --signature-policy "OR(Org1MSP.peer)" and call Init function first.
  3. Invoke chaincode function use Node SDK (API client).
  4. Migrate Fabric v2.2.2 to v2.5.4 with Couch v3.3.2 , Orderer v3.3.2, CA v1.5.6
  5. check peer join the channel or not by using command docker exec -it peer0.org1.example.com peer channel list
  6. Invoke chaincode function again using Node SDK (Api client)

I am getting error at this point.

denyeart commented 9 months ago

Perhaps the chaincode name is incorrect, the samples often use 'basic' as the deployed chaincode name instead of 'asset-transfer-basic'.

To troubleshoot you can post the peer log from startup time with some additional debug enabled, e.g.:

FABRIC_LOGGING_SPEC=debug:cauthdsl,policies,msp,grpc,peer.gossip.mcs,gossip,leveldbhelper=info

You can also use the discover client to identify which peers are available and which chaincodes are deployed along with their deployed endorsement policy layouts, e.g.:

discover --configFile conf.yaml --userKey /<fabric-samples_location>/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/priv_sk --userCert /<fabric-samples_location>/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem --peerTLSCA /<fabric-samples_location>/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --MSP Org1MSP saveConfig

discover --configFile conf.yaml peers --channel mychannel --server localhost:7051

discover --configFile conf.yaml endorsers --channel mychannel --chaincode basic --server localhost:7051