validation of endorsement policy for chaincode failed #hyperledger-fabric #consensus #fabric-chaincode


dodo_cpc@...
 

Hi All,
 

I have blockchain network consisting of two ORGs, each ORG having only single peer. And I have simple chaincode with several functions. One function that I'm invoking has two operations: read data from the implicit collection and write some other data to the ledger.

When I execute HLF transaction(against above chaincode function) then I'm getting:

[vscc] Validate -> ERRO VSCC error: stateBasedValidator.Validate failed, err validation of endorsement policy for chaincode test in tx 19:0 failed: implicit policy evaluation failed - 1 sub-policies were satisfied, but this policy requires 2 of the 'Endorsement' sub-policies to be satisfied

[committer.txvalidator] ValidateWithPlugin -> DEBU 57265[0m Transaction ad42fd0a0ab21c8d05c2feab860e9a6865af6d6cf6b6924bd6f0d726d114148f appears to be invalid: validation of endorsement policy for chaincode test in tx 19:0 failed: implicit policy evaluation failed - 1 sub-policies were satisfied, but this policy requires 2 of the 'Endorsement' sub-policies to be satisfied

This is logs from one of the peer. Chaincode logs are okay, transactions are executed properly on both peers. It seems that problem is during tx workflow commit phase.

When I comment reading private data from implicit collection opearation(instead I'm using hardcoded value) than everything is working just fine.

I have endorsement policy set to MAJORITY so both organizations are triggered.

The only difference is the operation which reads the private data from implicit collection - from my perspective this is the reason of transaction failure.

The private data is very simple: it is URL stored under "uri" key in both implicit collections. Values of URLs are different but keys are the same.

I would appreciate any help and tips.


@chbtt
 

Hey,

I believe this might be a problem with the read/write set of your transactions. In your chaincode, read the private data hash (as suggested here) of the other (in terms of execution environment) peer and see if it works. You could probably also just read the private data hashes from both organizations implicit collections and compare them for the sake of achieving consistent r/w sets.

Christoph