Re: chaincode 2.0 problems
Nikhil Gupta
The approval is at the Org level. You only need to target one peer, and then the approval is distributed to other peers using gossip. The endorsement error also pops up if you try to commit a different chaincode definition than the one that was approved. -----fabric@... wrote: ----- To: "Tong Li" <litong01@...> From: "David Enyeart" Sent by: fabric@... Date: 01/08/2020 12:28AM Cc: fabric@... Subject: [EXTERNAL] Re: [Hyperledger Fabric] chaincode 2.0 problems 1. You should be able to re-approveformyorg on the same peer, and the other peer (although it only needs to be done on one peer per org). I've tried this and it works in my environment... I can't think of a reason why you'd get ENDORSEMENT_POLICY_FAILURE on subsequent trials, as the approveformyorg transaction only requires endorsement on the org's own peer. See if you can re-approveformyorg on the same peer as before, just to help narrow down the problem... Have been trying to use the new peer lifecycle command to approve and eventually commit the chaincode but I have found two problems. 1. with 2 orgs and total of 4 peers, I can only do approveformyorg exactly two approvals. Once I have two approvals, see below output from checkcommitreadiness { "approvals": { "org0examplecom": true, "org1examplecom": true } } That shows that I have two approvals from two different orgs. Then I tried to use two other peers to do the approval, when I tried that, I got an error below. peer lifecycle chaincode approveformyorg --channelID mychannel --name simple2 --version 1.0 --package-id simple2_1.0:46b05e58222be471f9c305ad2ca3374e25343076502adcc82159865986dc3288 --init-required --sequence 1 --tls true --cafile $ORDERER_TLS_CA 2020-01-08 04:04:50.026 UTC [cli.lifecycle.chaincode] setOrdererClient -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer1.example.com:7050 2020-01-08 04:04:52.130 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [2fb5dafa70316b2d69a736ab8a1be399668f724646e66241ab4c2ce28f873c80] committed with status (ENDORSEMENT_POLICY_FAILURE) at Error: transaction invalidated with status (ENDORSEMENT_POLICY_FAILURE) Though I already have two approvals, I expect more approval from different peers wont fail, but it did, I do not know if that is expected behavior, please someone confirm one way or the other. 2. With two approvals from both orgs, I should have already met the majority requirement, but when I tried to do the commit, I was getting the exact same error as the approveformyorg process. Can someone please help with this problem? Please see the configtx.yaml file below if that can give a bit of clue. Thanks very much. --- Organizations: - &examplecom Name: examplecom ID: examplecom MSPDir: keyfiles/ordererOrganizations/example.com/msp Policies: Readers: Type: Signature Rule: "OR('examplecom.member')" Writers: Type: Signature Rule: "OR('examplecom.member')" Admins: Type: Signature Rule: "OR('examplecom.admin')" - &org0examplecom Name: org0examplecom ID: org0examplecom MSPDir: keyfiles/peerOrganizations/org0.example.com/msp Policies: Readers: Type: Signature Rule: "OR('org0examplecom.admin', 'org0examplecom.peer', 'org0examplecom.client')" Writers: Type: Signature Rule: "OR('org0examplecom.admin', 'org0examplecom.client')" Admins: Type: Signature Rule: "OR('org0examplecom.admin')" Endorsement: Type: Signature Rule: "OR('org0examplecom.peer')" AnchorPeers: - Host: peer1.org0.example.com Port: 7051 - Host: peer2.org0.example.com Port: 7051 - &org1examplecom Name: org1examplecom ID: org1examplecom MSPDir: keyfiles/peerOrganizations/org1.example.com/msp Policies: Readers: Type: Signature Rule: "OR('org1examplecom.admin', 'org1examplecom.peer', 'org1examplecom.client')" Writers: Type: Signature Rule: "OR('org1examplecom.admin', 'org1examplecom.client')" Admins: Type: Signature Rule: "OR('org1examplecom.admin')" Endorsement: Type: Signature Rule: "OR('org1examplecom.peer')" AnchorPeers: - Host: peer1.org1.example.com Port: 7051 - Host: peer2.org1.example.com Port: 7051 Capabilities: Channel: &ChannelCapabilities V2_0: true Orderer: &OrdererCapabilities V2_0: true Application: &ApplicationCapabilities V2_0: true Application: &ApplicationDefaults Organizations: Policies: Readers: Type: ImplicitMeta Rule: "ANY Readers" Writers: Type: ImplicitMeta Rule: "ANY Writers" Admins: Type: ImplicitMeta Rule: "MAJORITY Admins" LifecycleEndorsement: Type: ImplicitMeta Rule: "MAJORITY Endorsement" Endorsement: Type: ImplicitMeta Rule: "MAJORITY Endorsement" Capabilities: <<: *ApplicationCapabilities Orderer: &OrdererDefaults OrdererType: etcdraft Addresses: - orderer1.example.com:7050 - orderer2.example.com:7050 - orderer3.example.com:7050 BatchTimeout: 2s BatchSize: MaxMessageCount: 10 AbsoluteMaxBytes: 99 MB PreferredMaxBytes: 512 KB EtcdRaft: Consenters: - Host: orderer1.example.com Port: 7050 ClientTLSCert: keyfiles/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt ServerTLSCert: keyfiles/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt - Host: orderer2.example.com Port: 7050 ClientTLSCert: keyfiles/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt ServerTLSCert: keyfiles/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt - Host: orderer3.example.com Port: 7050 ClientTLSCert: keyfiles/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt ServerTLSCert: keyfiles/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt Organizations: Policies: Readers: Type: ImplicitMeta Rule: "ANY Readers" Writers: Type: ImplicitMeta Rule: "ANY Writers" Admins: Type: ImplicitMeta Rule: "MAJORITY Admins" BlockValidation: Type: ImplicitMeta Rule: "ANY Writers" Channel: &ChannelDefaults Policies: Readers: Type: ImplicitMeta Rule: "ANY Readers" Writers: Type: ImplicitMeta Rule: "ANY Writers" Admins: Type: ImplicitMeta Rule: "MAJORITY Admins" Capabilities: <<: *ChannelCapabilities Profiles: OrgChannel: Consortium: SampleConsortium <<: *ChannelDefaults Application: <<: *ApplicationDefaults Organizations: - *org0examplecom - *org1examplecom Capabilities: <<: *ApplicationCapabilities OrdererGenesis: <<: *ChannelDefaults Capabilities: <<: *ChannelCapabilities Orderer: <<: *OrdererDefaults Organizations: - *examplecom Capabilities: <<: *OrdererCapabilities Application: <<: *ApplicationDefaults Organizations: - <<: *examplecom Consortiums: SampleConsortium: Organizations: - *org0examplecom - *org1examplecom Tong Li IBM Open Technology
|
|