statebased.NewStateEP(ep) does not preserve NOutOf? #fabric #fabric-chaincode


Yueming Xu
 

If you call statebased.NewStateEP(ep), the returned KeyEndorsementPolicy will make all identities required to endorse.  Even if the original EP requires only 2 outOf 3 orgs to endorse, the policy returned by NewStateEP() will make it 3 outOf 3.  I guess that this interface is designed for policies that require all participants to endorse, and so you cannot use this `KeyEndorsementPolicy interface to define endorsement policies that require only m outOf n orgs.  Is that right?


David Enyeart
 

That's right. But you don't have to use the provided implementation, you can simply use it as an example for how to set policies in your own implementation. Look at the provided policyFromMSPIDs() and you'll see how to write a NOutOf policy to meet your needs:
https://github.com/hyperledger/fabric-chaincode-go/blob/master/pkg/statebased/statebasedimpl.go#L103-L143


Dave Enyeart

"Yueming Xu" ---01/17/2021 02:02:18 PM---If you call statebased.NewStateEP(ep), the returned KeyEndorsementPolicy will make all identities re

From: "Yueming Xu" <yxucolo@...>
To: fabric@...
Date: 01/17/2021 02:02 PM
Subject: [EXTERNAL] [Hyperledger Fabric] statebased.NewStateEP(ep) does not preserve NOutOf? #fabric #fabric-chaincode
Sent by: fabric@...





If you call statebased.NewStateEP(ep), the returned KeyEndorsementPolicy will make all identities required to endorse. Even if the original EP requires only 2 outOf 3 orgs to endorse, the policy returned by NewStateEP() will make it 3 outOf 3. I guess that this interface is designed for policies that require all participants to endorse, and so you cannot use this `KeyEndorsementPolicy interface to define endorsement policies that require only m outOf n orgs. Is that right?