Fabric 2.0: commit readiness returns false but approvalformyorg returned success


Siddharth Jain
 

we have a network of 3 orgs


we executed approvalformyorg for each org. our command looked like following

peer lifecycle chaincode approveformyorg \
 --channelID $CHANNEL_ID \
 --name $NAME \
 --version $VERSION \
 --package-id $PACKAGE_ID \
 --sequence 1 \
 --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')" \


here is sample output when we ran the command for an org: https://gist.github.com/siddjain/6b25bc35e708faf412048423bda02652. it says
2020-03-02 16:04:52.583 PST [chaincodeCmd] ClientWait -> INFO 039 txid [5102fa8dc652f1effbf793639df0665ef3f2649b6d30a49ce7192da10a7dc7d2] committed with status (VALID) at


2020-03-02 16:04:50.368 PST [lifecycle] ApproveChaincodeDefinitionForOrg -> INFO 033 Successfully endorsed chaincode approval with name 'mycc', package ID 'mycc_1.0:ce4e81ee8835ad0a01f7629b4646f52535b91378311f11cee703b3011d7adfdf', on channel 'tracktrace' with definition {sequence: 1, endorsement info: (version: '1.0', plugin: 'escc', init required: false), validation info: (plugin: 'vscc', policy: '0a481210120e08031202080012020801120208021a0f120d0a0942696f746f724d535010031a0d120b0a07584d65644d535010031a1412120a0e4b6579506861726d6163794d53501003'), collections: ()}
2020-03-02 16:04:50.368 PST [endorser] callChaincode -> INFO 034 finished chaincode: _lifecycle duration: 186ms channel=tracktrace txID=5102fa8d
2020-03-02 16:04:52.583 PST [kvledger] CommitLegacy -> INFO 039 [tracktrace] Committed block [1] with 1 transaction(s)

we executed approvalformyorg on all 3 orgs

but when we run the checkcommitreadiness command we get false for each of the 3 orgs. 

anyone knows what is wrong here and how to fix it?


Siddharth Jain
 


if existingValue, ok := existingKeys[keyName]; !ok || !bytes.Equal(existingValue, util.ComputeSHA256(marshaledFieldValue)) {
return false, nil // false means chaincode definition has not been approved
}
ok is true and I see existingKeys and existingValue as well



so the bytes.Equal(existingValue, util.ComputeSHA256(marshaledFieldValue)) must be failing

I am not a Go developer but when I try to eval the expression in VS Code this is what I get:


does above have to do with this bug: https://github.com/microsoft/vscode-go/issues/2655
What debugger do Fabric devs use to debug Go code?


From: Siddharth Jain <siddjain@...>
Sent: Monday, March 2, 2020 5:15 PM
To: fabric@... <fabric@...>
Subject: Fabric 2.0: commit readiness returns false but approvalformyorg returned success
 
we have a network of 3 orgs


we executed approvalformyorg for each org. our command looked like following

peer lifecycle chaincode approveformyorg \
 --channelID $CHANNEL_ID \
 --name $NAME \
 --version $VERSION \
 --package-id $PACKAGE_ID \
 --sequence 1 \
 --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')" \


here is sample output when we ran the command for an org: https://gist.github.com/siddjain/6b25bc35e708faf412048423bda02652. it says
2020-03-02 16:04:52.583 PST [chaincodeCmd] ClientWait -> INFO 039 txid [5102fa8dc652f1effbf793639df0665ef3f2649b6d30a49ce7192da10a7dc7d2] committed with status (VALID) at


2020-03-02 16:04:50.368 PST [lifecycle] ApproveChaincodeDefinitionForOrg -> INFO 033 Successfully endorsed chaincode approval with name 'mycc', package ID 'mycc_1.0:ce4e81ee8835ad0a01f7629b4646f52535b91378311f11cee703b3011d7adfdf', on channel 'tracktrace' with definition {sequence: 1, endorsement info: (version: '1.0', plugin: 'escc', init required: false), validation info: (plugin: 'vscc', policy: '0a481210120e08031202080012020801120208021a0f120d0a0942696f746f724d535010031a0d120b0a07584d65644d535010031a1412120a0e4b6579506861726d6163794d53501003'), collections: ()}
2020-03-02 16:04:50.368 PST [endorser] callChaincode -> INFO 034 finished chaincode: _lifecycle duration: 186ms channel=tracktrace txID=5102fa8d
2020-03-02 16:04:52.583 PST [kvledger] CommitLegacy -> INFO 039 [tracktrace] Committed block [1] with 1 transaction(s)

we executed approvalformyorg on all 3 orgs

but when we run the checkcommitreadiness command we get false for each of the 3 orgs. 

anyone knows what is wrong here and how to fix it?


Siddharth Jain
 

if i add call i get



From: Siddharth Jain <siddjain@...>
Sent: Tuesday, March 3, 2020 11:00 AM
To: fabric@... <fabric@...>
Subject: Re: Fabric 2.0: commit readiness returns false but approvalformyorg returned success
 

if existingValue, ok := existingKeys[keyName]; !ok || !bytes.Equal(existingValue, util.ComputeSHA256(marshaledFieldValue)) {
return false, nil // false means chaincode definition has not been approved
}
ok is true and I see existingKeys and existingValue as well



so the bytes.Equal(existingValue, util.ComputeSHA256(marshaledFieldValue)) must be failing

I am not a Go developer but when I try to eval the expression in VS Code this is what I get:


does above have to do with this bug: https://github.com/microsoft/vscode-go/issues/2655
What debugger do Fabric devs use to debug Go code?


From: Siddharth Jain <siddjain@...>
Sent: Monday, March 2, 2020 5:15 PM
To: fabric@... <fabric@...>
Subject: Fabric 2.0: commit readiness returns false but approvalformyorg returned success
 
we have a network of 3 orgs


we executed approvalformyorg for each org. our command looked like following

peer lifecycle chaincode approveformyorg \
 --channelID $CHANNEL_ID \
 --name $NAME \
 --version $VERSION \
 --package-id $PACKAGE_ID \
 --sequence 1 \
 --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')" \


here is sample output when we ran the command for an org: https://gist.github.com/siddjain/6b25bc35e708faf412048423bda02652. it says
2020-03-02 16:04:52.583 PST [chaincodeCmd] ClientWait -> INFO 039 txid [5102fa8dc652f1effbf793639df0665ef3f2649b6d30a49ce7192da10a7dc7d2] committed with status (VALID) at


2020-03-02 16:04:50.368 PST [lifecycle] ApproveChaincodeDefinitionForOrg -> INFO 033 Successfully endorsed chaincode approval with name 'mycc', package ID 'mycc_1.0:ce4e81ee8835ad0a01f7629b4646f52535b91378311f11cee703b3011d7adfdf', on channel 'tracktrace' with definition {sequence: 1, endorsement info: (version: '1.0', plugin: 'escc', init required: false), validation info: (plugin: 'vscc', policy: '0a481210120e08031202080012020801120208021a0f120d0a0942696f746f724d535010031a0d120b0a07584d65644d535010031a1412120a0e4b6579506861726d6163794d53501003'), collections: ()}
2020-03-02 16:04:50.368 PST [endorser] callChaincode -> INFO 034 finished chaincode: _lifecycle duration: 186ms channel=tracktrace txID=5102fa8d
2020-03-02 16:04:52.583 PST [kvledger] CommitLegacy -> INFO 039 [tracktrace] Committed block [1] with 1 transaction(s)

we executed approvalformyorg on all 3 orgs

but when we run the checkcommitreadiness command we get false for each of the 3 orgs. 

anyone knows what is wrong here and how to fix it?


Nikhil Gupta
 

Can you send the checkcommitreadiness command that you submitted?

-----fabric@... wrote: -----
To: "fabric@..." <fabric@...>
From: "Siddharth Jain"
Sent by: fabric@...
Date: 03/02/2020 08:16PM
Subject: [EXTERNAL] [Hyperledger Fabric] Fabric 2.0: commit readiness returns false but approvalformyorg returned success

we have a network of 3 orgs


we executed approvalformyorg for each org. our command looked like following

peer lifecycle chaincode approveformyorg \
 --channelID $CHANNEL_ID \
 --name $NAME \
 --version $VERSION \
 --package-id $PACKAGE_ID \
 --sequence 1 \
 --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')" \


here is sample output when we ran the command for an org: https://gist.github.com/siddjain/6b25bc35e708faf412048423bda02652. it says
2020-03-02 16:04:52.583 PST [chaincodeCmd] ClientWait -> INFO 039 txid [5102fa8dc652f1effbf793639df0665ef3f2649b6d30a49ce7192da10a7dc7d2] committed with status (VALID) at


2020-03-02 16:04:50.368 PST [lifecycle] ApproveChaincodeDefinitionForOrg -> INFO 033 Successfully endorsed chaincode approval with name 'mycc', package ID 'mycc_1.0:ce4e81ee8835ad0a01f7629b4646f52535b91378311f11cee703b3011d7adfdf', on channel 'tracktrace' with definition {sequence: 1, endorsement info: (version: '1.0', plugin: 'escc', init required: false), validation info: (plugin: 'vscc', policy: '0a481210120e08031202080012020801120208021a0f120d0a0942696f746f724d535010031a0d120b0a07584d65644d535010031a1412120a0e4b6579506861726d6163794d53501003'), collections: ()}
2020-03-02 16:04:50.368 PST [endorser] callChaincode -> INFO 034 finished chaincode: _lifecycle duration: 186ms channel=tracktrace txID=5102fa8d
2020-03-02 16:04:52.583 PST [kvledger] CommitLegacy -> INFO 039 [tracktrace] Committed block [1] with 1 transaction(s)

we executed approvalformyorg on all 3 orgs

but when we run the checkcommitreadiness command we get false for each of the 3 orgs. 

anyone knows what is wrong here and how to fix it?



Siddharth Jain
 

that was the problem. it was missing the signature policy. we have fixed it since.


From: Nikhil E Gupta <negupta@...>
Sent: Monday, March 9, 2020 7:22 AM
To: Siddharth Jain <siddjain@...>
Cc: fabric@... <fabric@...>
Subject: Re: [Hyperledger Fabric] Fabric 2.0: commit readiness returns false but approvalformyorg returned success
 
Can you send the checkcommitreadiness command that you submitted?

-----fabric@... wrote: -----
To: "fabric@..." <fabric@...>
From: "Siddharth Jain"
Sent by: fabric@...
Date: 03/02/2020 08:16PM
Subject: [EXTERNAL] [Hyperledger Fabric] Fabric 2.0: commit readiness returns false but approvalformyorg returned success

we have a network of 3 orgs


we executed approvalformyorg for each org. our command looked like following

peer lifecycle chaincode approveformyorg \
 --channelID $CHANNEL_ID \
 --name $NAME \
 --version $VERSION \
 --package-id $PACKAGE_ID \
 --sequence 1 \
 --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')" \


here is sample output when we ran the command for an org: https://gist.github.com/siddjain/6b25bc35e708faf412048423bda02652. it says
2020-03-02 16:04:52.583 PST [chaincodeCmd] ClientWait -> INFO 039 txid [5102fa8dc652f1effbf793639df0665ef3f2649b6d30a49ce7192da10a7dc7d2] committed with status (VALID) at


2020-03-02 16:04:50.368 PST [lifecycle] ApproveChaincodeDefinitionForOrg -> INFO 033 Successfully endorsed chaincode approval with name 'mycc', package ID 'mycc_1.0:ce4e81ee8835ad0a01f7629b4646f52535b91378311f11cee703b3011d7adfdf', on channel 'tracktrace' with definition {sequence: 1, endorsement info: (version: '1.0', plugin: 'escc', init required: false), validation info: (plugin: 'vscc', policy: '0a481210120e08031202080012020801120208021a0f120d0a0942696f746f724d535010031a0d120b0a07584d65644d535010031a1412120a0e4b6579506861726d6163794d53501003'), collections: ()}
2020-03-02 16:04:50.368 PST [endorser] callChaincode -> INFO 034 finished chaincode: _lifecycle duration: 186ms channel=tracktrace txID=5102fa8d
2020-03-02 16:04:52.583 PST [kvledger] CommitLegacy -> INFO 039 [tracktrace] Committed block [1] with 1 transaction(s)

we executed approvalformyorg on all 3 orgs

but when we run the checkcommitreadiness command we get false for each of the 3 orgs. 

anyone knows what is wrong here and how to fix it?



Manindra Singh
 

Hi,

I have a network of 2 orgs - Org1 and Org2. I am getting the same error when checking commit readiness using following even though I ran approveformyorg on both Orgs:
Command: peer lifecycle chaincode checkcommitreadiness --channelID allarewelcome --name sacc --version 1.0 --sequence 1 --output json
Output:
{
"approvals": {
"Org1MSP": false,
"Org2MSP": false
}
}

Executed the approveformyorg command on both Org1 and Org2:
Command: peer lifecycle chaincode approveformyorg -o orderer.example.com:7050 --tls --cafile $ORDERER_TLS_CA --name sacc --version 1.0 --channelID allarewelcome --sequence 1 --package-id $CC_PACKAGE_ID --init-required true --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer')"
Output for Org1:
2020-12-26 12:46:35.726 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [9c46efbd1cbac697c4ae1ff1dbe68554a4348523664e7a8ef27b1bb93dd6848d] committed with status (VALID) at peer0.org1.example.com:7051

Logs from peer0.org1.example.com:
2020-12-26 12:46:33.199 UTC [lifecycle] ApproveChaincodeDefinitionForOrg -> INFO 09b Successfully endorsed chaincode approval with name 'sacc', package ID 'sacc_1.0:5562f868f6fd43ff8873f403aa52bc6928161fec933065d0b81e2193f6038bd0', on channel 'allarewelcome' with definition {sequence: 1, endorsement info: (version: '1.0', plugin: 'escc', init required: true), validation info: (plugin: 'vscc', policy: '0a2c120c120a080212020800120208011a0d120b0a074f7267314d535010031a0d120b0a074f7267324d53501003'), collections: ()}


Similar output for Org2 also. As mentioned by Siddharth, signature policy is also specified in approveformyorg command but still getting the same issue. Can anyone help with anything else that is missing? Please let me know if I need to provide any more details.


Manindra Singh
 

Hi Nikhil,

In response to your following comment, I re-ran the commit readiness command with those options but still get the same result:
"I do not see the following parameters on the commit readiness command: --init-required true --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer')" "
Command: peer lifecycle chaincode checkcommitreadiness -o orderer.example.com:7050 --channelID allarewelcome --tls --cafile $ORDERER_TLS_CA -name sacc --version 1.0 --sequence 1 --init-required true --signature-policy "AND ('Org1MSP.peer','Org2MSP.peer')" --output json

Output:

{
"approvals": {
"Org1MSP": false,
"Org2MSP": false
}
}

Hi Chris,

In response to your following comment, please find the result of querying installed chaincodes, $
CC_PACKAGE_ID on Org1 peer(same result comes for Org2 peer also):
"If you query the peer for installed chaincodes, what is the output?
You are using a variable export ($CC_PACKAGE_ID) to represent the packageID. Please note actual value of $CC_PACKAGE_ID and make sure it matches the one in your output (in this instance from your log below...sacc_1.0:5562f868f6fd43ff8873f403aa52bc6928161fec933065d0b81e2193f6038bd0)"
Command: peer lifecycle chaincode queryinstalled
Output: 
Installed chaincodes on peer:
Package ID: sacc_1.0:5562f868f6fd43ff8873f403aa52bc6928161fec933065d0b81e2193f6038bd0, Label: sacc_1.0

Command: echo $CC_PACKAGE_ID
Output: sacc_1.0:5562f868f6fd43ff8873f403aa52bc6928161fec933065d0b81e2193f6038bd0



Manindra Singh
 

Hi All,

Just to close this thread, I had restarted the network and ran through the steps again and it worked fine without making any fix. Could not reproduce the issue again. Thanks.