Skip to content

Commit 24f35c1

Browse files
committed
[FAB-7750] first network with support to FAB-5664
This change-set does the following: - it modifies the first-network example to show how to use FAB-5664. Namely, the identity classification is enabled by setting EnableNodeOUs to true in crypto-config.yaml. Then, the endorsement policy is changed to requires peers and not members. Finally, cryptotx.yaml is modified to enable v1.1 capabilities. Change-Id: If8e943b5833b4402d612895449ac110ab2fee4b5 Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent 5dffcfb commit 24f35c1

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

first-network/configtx.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
Profiles:
1616

1717
TwoOrgsOrdererGenesis:
18+
Capabilities:
19+
<<: *ChannelCapabilities
1820
Orderer:
1921
<<: *OrdererDefaults
2022
Organizations:
2123
- *OrdererOrg
24+
Capabilities:
25+
<<: *OrdererCapabilities
2226
Consortiums:
2327
SampleConsortium:
2428
Organizations:
@@ -31,6 +35,8 @@ Profiles:
3135
Organizations:
3236
- *Org1
3337
- *Org2
38+
Capabilities:
39+
<<: *ApplicationCapabilities
3440

3541
################################################################################
3642
#
@@ -147,3 +153,52 @@ Application: &ApplicationDefaults
147153
# Organizations is the list of orgs which are defined as participants on
148154
# the application side of the network
149155
Organizations:
156+
157+
################################################################################
158+
#
159+
# SECTION: Capabilities
160+
#
161+
# - This section defines the capabilities of fabric network. This is a new
162+
# concept as of v1.1.0 and should not be utilized in mixed networks with
163+
# v1.0.x peers and orderers. Capabilities define features which must be
164+
# present in a fabric binary for that binary to safely participate in the
165+
# fabric network. For instance, if a new MSP type is added, newer binaries
166+
# might recognize and validate the signatures from this type, while older
167+
# binaries without this support would be unable to validate those
168+
# transactions. This could lead to different versions of the fabric binaries
169+
# having different world states. Instead, defining a capability for a channel
170+
# informs those binaries without this capability that they must cease
171+
# processing transactions until they have been upgraded. For v1.0.x if any
172+
# capabilities are defined (including a map with all capabilities turned off)
173+
# then the v1.0.x peer will deliberately crash.
174+
#
175+
################################################################################
176+
Capabilities:
177+
# Channel capabilities apply to both the orderers and the peers and must be
178+
# supported by both. Set the value of the capability to true to require it.
179+
Global: &ChannelCapabilities
180+
# V1.1 for Global is a catchall flag for behavior which has been
181+
# determined to be desired for all orderers and peers running v1.0.x,
182+
# but the modification of which would cause incompatibilities. Users
183+
# should leave this flag set to true.
184+
V1_1: true
185+
186+
# Orderer capabilities apply only to the orderers, and may be safely
187+
# manipulated without concern for upgrading peers. Set the value of the
188+
# capability to true to require it.
189+
Orderer: &OrdererCapabilities
190+
# V1.1 for Order is a catchall flag for behavior which has been
191+
# determined to be desired for all orderers running v1.0.x, but the
192+
# modification of which would cause incompatibilities. Users should
193+
# leave this flag set to true.
194+
V1_1: true
195+
196+
# Application capabilities apply only to the peer network, and may be safely
197+
# manipulated without concern for upgrading orderers. Set the value of the
198+
# capability to true to require it.
199+
Application: &ApplicationCapabilities
200+
# V1.1 for Application is a catchall flag for behavior which has been
201+
# determined to be desired for all peers running v1.0.x, but the
202+
# modification of which would cause incompatibilities. Users should
203+
# leave this flag set to true.
204+
V1_1: true

first-network/crypto-config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ PeerOrgs:
2626
# ---------------------------------------------------------------------------
2727
- Name: Org1
2828
Domain: org1.example.com
29+
EnableNodeOUs: true
2930
# ---------------------------------------------------------------------------
3031
# "Specs"
3132
# ---------------------------------------------------------------------------
@@ -75,6 +76,7 @@ PeerOrgs:
7576
# ---------------------------------------------------------------------------
7677
- Name: Org2
7778
Domain: org2.example.com
79+
EnableNodeOUs: true
7880
Template:
7981
Count: 2
8082
Users:

first-network/scripts/utils.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ instantiateChaincode () {
116116
# while 'peer chaincode' command can get the orderer endpoint from the peer (if join was successful),
117117
# lets supply it directly as we know it using the "-o" option
118118
if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
119-
peer chaincode instantiate -o orderer.example.com:7050 -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v ${VERSION} -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')" >&log.txt
119+
peer chaincode instantiate -o orderer.example.com:7050 -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v ${VERSION} -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')" >&log.txt
120120
else
121-
peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')" >&log.txt
121+
peer chaincode instantiate -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -l ${LANGUAGE} -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')" >&log.txt
122122
fi
123123
res=$?
124124
cat log.txt
@@ -132,7 +132,7 @@ upgradeChaincode () {
132132
ORG=$2
133133
setGlobals $PEER $ORG
134134

135-
peer chaincode upgrade -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -v 2.0 -c '{"Args":["init","a","90","b","210"]}' -P "OR ('Org1MSP.member','Org2MSP.member','Org3MSP.member')"
135+
peer chaincode upgrade -o orderer.example.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -v 2.0 -c '{"Args":["init","a","90","b","210"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer','Org3MSP.peer')"
136136
res=$?
137137
cat log.txt
138138
verifyResult $res "Chaincode upgrade on org${ORG} peer${PEER} has Failed"

0 commit comments

Comments
 (0)