Change Endorsement Policy in configtx.yaml to use NoutOf rule, so any 2 of the organizations can approve chaincode lifecycle

This commit is contained in:
Ferry Ariawan 2024-06-10 20:07:49 +07:00
parent 16b3eea508
commit 6c074d0361
2 changed files with 19 additions and 14 deletions

View file

@ -207,11 +207,17 @@ Application: &ApplicationDefaults
Type: ImplicitMeta Type: ImplicitMeta
Rule: "MAJORITY Admins" Rule: "MAJORITY Admins"
LifecycleEndorsement: LifecycleEndorsement:
Type: ImplicitMeta # Type: ImplicitMeta
Rule: "MAJORITY Endorsement" # Rule: "MAJORITY Endorsement"
Type: Signature
Rule: "OutOf(2, 'FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
# Rule: "OR('FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
Endorsement: Endorsement:
Type: ImplicitMeta # Type: ImplicitMeta
Rule: "MAJORITY Endorsement" # Rule: "MAJORITY Endorsement"
Type: Signature
Rule: "OutOf(2, 'FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
# Rule: "OR('FarmerMSP.peer', 'PulperMSP.peer', 'HullerMSP.peer', 'ExportMSP.peer')"
Capabilities: Capabilities:
<<: *ApplicationCapabilities <<: *ApplicationCapabilities
################################################################################ ################################################################################

View file

@ -78,10 +78,10 @@ infoln "Install chaincode on peer0.farmer..."
installChaincode farmer installChaincode farmer
infoln "Install chaincode on peer0.pulper..." infoln "Install chaincode on peer0.pulper..."
installChaincode pulper installChaincode pulper
infoln "Install chaincode on peer0.huller..." #infoln "Install chaincode on peer0.huller..."
installChaincode huller #installChaincode huller
infoln "Install chaincode on peer0.export..." #infoln "Install chaincode on peer0.export..."
installChaincode export #installChaincode export
resolveSequence resolveSequence
@ -104,22 +104,21 @@ approveForMyOrg pulper
checkCommitReadiness farmer "\"FarmerMSP\": true" "\"PulperMSP\": true" checkCommitReadiness farmer "\"FarmerMSP\": true" "\"PulperMSP\": true"
checkCommitReadiness pulper "\"FarmerMSP\": true" "\"PulperMSP\": true" checkCommitReadiness pulper "\"FarmerMSP\": true" "\"PulperMSP\": true"
approveForMyOrg huller #approveForMyOrg huller
approveForMyOrg export #approveForMyOrg export
## now that we know for sure both orgs have approved, commit the definition ## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition farmer pulper huller export commitChaincodeDefinition farmer pulper #huller #export
## query on both orgs to see that the definition committed successfully ## query on both orgs to see that the definition committed successfully
queryCommitted farmer pulper huller export queryCommitted farmer pulper #huller #export
## Invoke the chaincode - this does require that the chaincode have the 'initLedger' ## Invoke the chaincode - this does require that the chaincode have the 'initLedger'
## method defined ## method defined
if [ "$CC_INIT_FCN" = "NA" ]; then if [ "$CC_INIT_FCN" = "NA" ]; then
infoln "Chaincode initialization is not required" infoln "Chaincode initialization is not required"
else else
chaincodeInvokeInit farmer pulper huller export chaincodeInvokeInit farmer pulper #huller #export
fi fi
exit 0 exit 0